Message74368
I tried to process a text file (with UTF-8 encoding) which has
contents like this:
FILE=India
asbds
FILE=Indonasia
ssgsds
FILE=Africa
DBGDGDFG
When I use the below code:
>>> f = open("e:\\temp\\file.txt", 'r')
>>> lines = f.readlines()
>>> for line in lines:
if line.startswith("FILE="):
print line.strip("FILE=")
I get output as:
ndia
ndonasia
Africa
I is always stripped if it follows the substring that I want to strip
off.
Am I doing something wrong here or is this a bug in Python?
-Govind |
|
Date |
User |
Action |
Args |
2008-10-06 13:04:30 | Govind | set | recipients:
+ Govind |
2008-10-06 13:04:30 | Govind | set | messageid: <1223298270.23.0.44559787847.issue4054@psf.upfronthosting.co.za> |
2008-10-06 13:04:29 | Govind | link | issue4054 messages |
2008-10-06 13:04:29 | Govind | create | |
|