Author harobed
Recipients harobed
Date 2010-03-29.15:09:53
SpamBayes Score 4.44846e-06
Marked as misclassified No
Message-id <1269875395.81.0.132261115225.issue8260@psf.upfronthosting.co.za>
In-reply-to
Content
This is an example, last assert return an error :

f = open('data.txt', 'w')
f.write("""line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
line 10
line 11
""")
f.close()


f = open('data.txt', 'r')
assert f.readline() == 'line 1\n'

assert f.read() == """line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
line 10
line 11
"""

f.close()

import codecs

f = codecs.open('data.txt', 'r', 'utf8')

assert f.read() == """line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
line 10
line 11
"""

f.close()

f = codecs.open('data.txt', 'r', 'utf8')

assert f.readline() == 'line 1\n'

# this assert return a ERROR
assert f.read() == """line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
line 10
line 11
"""

f.close()

Regards,
Stephane
History
Date User Action Args
2010-03-29 15:09:56harobedsetrecipients: + harobed
2010-03-29 15:09:55harobedsetmessageid: <1269875395.81.0.132261115225.issue8260@psf.upfronthosting.co.za>
2010-03-29 15:09:53harobedlinkissue8260 messages
2010-03-29 15:09:53harobedcreate