Τη Σάββατο, 8 Ιουνίου 2013 9:47:53 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:
> Fortunately, Python lets us hide away pretty much all those details, > just as it lets us hide away the details of what makes up a list, a > dictionary, or an integer. You can safely assume that the string "foo" > is a string of three characters, which you can work with as > characters. The chr() and ord() functions let you switch between > characters and numbers, and str.encode() and bytes.decode() let you > switch between characters and byte sequences. Once you get your head > around the differences between those three, it all works fairly > neatly. I'm trying too! So, chr('A') would give me the mapping of this char, the number 65 while ord(65) would output the char 'A' likewise. >and str.encode() and bytes.decode() let you switch between characters and byte >>sequences. Once What would happen if we we try to re-encode bytes on the disk? like trying: s = "νίκος" utf8_bytes = s.encode('utf-8') greek_bytes = utf_bytes.encode('iso-8869-7') Can we re-encode twice or as many times we want and then decode back respectively lke? utf8_bytes = greek_bytes.decode('iso-8859-7') s = utf8_bytes.decoce('utf-8') Is somethign like that totally crazy? And also is there a deiffrence between "encoding" and "compressing" ? Isnt the latter useing some form of encoding to take a string or bytes to make hold less space on disk? -- http://mail.python.org/mailman/listinfo/python-list