yes, they look like this ����������������������
so i used your print repr(chr(ord(i))) and got this '\x00' '\x06' '\x00' ':' '\x80' '\x1f' '\x16' 'g' 'J' 's' '\xde' '\xc0' 'J' 's' '\xde' '\xc0' '\xce' '\xcc' '\x06' '\n' '\x00' '\x00' ' ' '\xaf' 'J' 's' '\xde' '\xc0' so, what do i do now? and thanks for the info, by the way, been writing python for 2 years, but this is all new to me. shawn On Mon, Nov 3, 2008 at 11:28 AM, Lie Ryan <[EMAIL PROTECTED]> wrote: > On Mon, 03 Nov 2008 08:48:44 -0600, shawn bright wrote: > >> ok, i have another question: >> if i run this: >> #!/usr/bin/env python >> f = 'test_out' >> f = open(f, 'r').read() >> for i in f: >> print ord(i) >> >> I get this: >> 0 >> 6 >> 0 >> 58 >> 128 >> 31 >> 22 >> 103 >> 74 >> 115 >> 222 >> 192 >> 74 >> 115 >> 222 >> 192 (deleted some in the email for brevity) >> >> if i do >> for i in f: >> print chr(ord(i)) >> i get the same weird characters. >> should these be read some other way? > > Wait... are these "weird" characters in the form of: > ���������������������� > > or if you used "print repr(chr(ord(i)))": "\x87\x88\x89\x8a\x8b\x8c\x8d > \x8e\x8f\x90\x91" > > That is python's escape characters. Python's default byte-to-character > encoding is ASCII, a 7-bit encoding, values in the range(128, 256) cannot > be represented in ASCII so python uses � to represent these > unrepresentable characters. If you used repr(), it would escape the > unrepresentable characters into an escaped form, using '\xkk' where kk is > the two-digit hexadecimal representing the byte value of the character > > _______________________________________________ > Tutor maillist - [email protected] > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
