Message74367
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:01:58 | Govind | set | recipients:
+ Govind |
2008-10-06 13:01:58 | Govind | set | messageid: <1223298118.61.0.171396290216.issue4053@psf.upfronthosting.co.za> |
2008-10-06 13:01:57 | Govind | link | issue4053 messages |
2008-10-06 13:01:57 | Govind | create | |
|