reading from file

2009-06-11 Thread Sydoruk Yaroslav
Hello all, In a text file aword.txt, there is a string: "\xea\xe0\xea+\xef\xee\xe7\xe2\xee\xed\xe8\xf2\xfc". There is a first script: f = open ("aword.txt", "r") for line in f: print chardet.detect(line) b = line.decode('cp1251') print b _RESULT_ {'confidence': 1.0, 'encoding': '

Re: reading from file

2009-06-11 Thread Sydoruk Yaroslav
Jeff McNeil wrote: > Is the string in your text file literally "\xea\xe0\xea+\xef\xee > \xe7\xe2\xee\xed\xe8\xf2\xfc" as "plain text?" My assumption is that > when you're reading that in, Python is interpreting each byte as an > ASCII value (and rightfully so) rather than the corresponding '\x' >