.


:




:

































 

 

 

 





 

 

, . Harry Kemelman, The Nine Mile Walk

Windows 38493 , . Python 3 3000 . ; , . , .

, . Python :

a_file = open('examples/chinese.txt', encoding='utf-8')

Python open(), . 'examples/chinese.txt' 5 :

  1. , . , : , open() . Python, .
  2. / ( , , ), . Windows \ ( , , ) , Linux MacOS / ( , , ). Python , Windows.
  3. () , . ? , !
  4. . ( Windows) Unicode . Python 3 -ascii .
  5. . . (/proc linux). , Python .

open() . , encoding. , , !

; . . Unicode, . , Python ? Unicode (. . ).

>> file = open('examples/chinese.txt')>>> a_string = file.read()Traceback (most recent call last): File <stdin>, line 1, in <module> File C:\Python31\lib\encodings\cp1252.py, line 23, in decode return codecs.charmap_decode(input, self.errors, decoding_table)[0]UnicodeDecodeError: 'charmap' codec cant decode byte 0x8f in position 28: character maps to <undefined> [[: Python 3]]

XML

 

, . xml , . xml , , . () , , . , - , Google Reader [1]

, XML . Atom syndication feed

<?xml version='1.0' encoding='utf-8'?><feed xmlns='http://www.w3.org/2005/Atom' xml:lang='en'> <title>dive into mark</title> <subtitle>currently between addictions</subtitle> <id>tag:diveintomark.org,2001-07-29:/</id> <updated>2009-03-27T21:56:07Z</updated> <link rel='alternate' type='text/html' href='http://diveintomark.org/'/> <link rel='self' type='application/atom+xml' href='http://diveintomark.org/feed/'/> <entry> <author> <name>Mark</name> <uri>http://diveintomark.org/</uri> </author> <title>Dive into history, 2009 edition</title> <link rel='alternate' type='text/html' href='http://diveintomark.org/archives/2009/03/27/dive-into-history-2009-edition'/> <id>tag:diveintomark.org,2009-03-27:/archives/20090327172042</id> <updated>2009-03-27T21:56:07Z</updated> <published>2009-03-27T17:20:42Z</published> <category scheme='http://diveintomark.org' term='diveintopython'/> <category scheme='http://diveintomark.org' term='docbook'/> <category scheme='http://diveintomark.org' term='html'/> <summary type='html'>Putting an entire chapter on one page sounds bloated, but consider this &amp;mdash; my longest chapter so far would be 75 printed pages, and it loads in under 5 seconds&amp;hellip; On dialup.</summary> </entry> <entry> <author> <name>Mark</name> <uri>http://diveintomark.org/</uri> </author> <title>Accessibility is a harsh mistress</title> <link rel='alternate' type='text/html' href='http://diveintomark.org/archives/2009/03/21/accessibility-is-a-harsh-mistress'/> <id>tag:diveintomark.org,2009-03-21:/archives/20090321200928</id> <updated>2009-03-22T01:05:37Z</updated> <published>2009-03-21T20:09:28Z</published> <category scheme='http://diveintomark.org' term='accessibility'/> <summary type='html'>The accessibility orthodoxy does not permit people to question the value of features that are rarely useful and rarely used.</summary> </entry> <entry> <author> <name>Mark</name> </author> <title>A gentle introduction to video encoding, part 1: container formats</title> <link rel='alternate' type='text/html' href='http://diveintomark.org/archives/2008/12/18/give-part-1-container-formats'/> <id>tag:diveintomark.org,2008-12-18:/archives/20081218155422</id> <updated>2009-01-11T19:39:22Z</updated> <published>2008-12-18T15:54:22Z</published> <category scheme='http://diveintomark.org' term='asf'/> <category scheme='http://diveintomark.org' term='avi'/> <category scheme='http://diveintomark.org' term='encoding'/> <category scheme='http://diveintomark.org' term='flv'/> <category scheme='http://diveintomark.org' term='GIVE'/> <category scheme='http://diveintomark.org' term='mp4'/> <category scheme='http://diveintomark.org' term='ogg'/> <category scheme='http://diveintomark.org' term='video'/> <summary type='html'>These notes will eventually become part of a tech talk on video encoding.</summary> </entry></feed>

XML

XML, .

XML . XML . , , XML :

<foo> ①</foo> ②

() foo.

() foo. , XML .

. bar foo, foo.

<foo> <bar></bar></foo>

XML . XML . XML , :

<foo></foo><bar></bar>

-. . [wp-rbin.com] . .

<foo lang='en'> ① <bar id='papayawhip' lang="fr"></bar> ②</foo>

① foo lang. lang en.

② bar : id lang. lang fr. lang foo, .

, . Python. .

( ).

<foo lang='en'> <bar lang='fr'>PapayaWhip</bar></foo>

.

<foo></foo>

. / , . XML :

<foo/>

Python , XML (namespaces). URL-. xmlns. , .

<feed xmlns='http://www.w3.org/2005/Atom'> ① <title>dive into mark</title> ②</feed>

① feed http://www.w3.org/2005/Atom.

② title http://www.w3.org/2005/Atom. .

xmlns:prefix prefix. prefix.

<atom:feed xmlns:atom='http://www.w3.org/2005/Atom'> ① <atom:title>dive into mark</atom:title> ②</atom:feed>

① feed http://www.w3.org/2005/Atom.

② title http://www.w3.org/2005/Atom.

XML, XML . + XML . , . , , ( ) , XML .

, , XML . ( XML- XML , Catch-22 F XML )

<?xml version='1.0' encoding='utf-8'?>

XML !





:


: 2016-11-18; !; : 322 |


:

:

, , .
==> ...

1339 - | 1259 -


© 2015-2024 lektsii.org - -

: 0.013 .