[issue4053] str.split unintentionally strips char 'I' from the string
Govind
report at bugs.python.org
Mon Oct 6 15:01:58 CEST 2008
New submission from Govind <avgovind at hotmail.com>:
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 <report at bugs.python.org>
<http://bugs.python.org/issue4053>
_______________________________________
More information about the Python-bugs-list
mailing list