New submission from Govind <[EMAIL PROTECTED]>:
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
----------
components: Library (Lib)
messages: 74367
nosy: Govind
severity: normal
status: open
title: str.split unintentionally strips char 'I' from the string
type: behavior
versions: Python 2.5
_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4053>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com