classification
Title: str.split unintentionally strips char 'I' from the string
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: Govind, vstinner
Priority: normal Keywords:

Created on 2008-10-06 13:01 by Govind, last changed 2008-10-06 13:05 by vstinner. This issue is now closed.

Messages (2)
msg74367 - (view) Author: Govind (Govind) Date: 2008-10-06 13:01
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
msg74369 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2008-10-06 13:05
Duplicate of issue4054.
History
Date User Action Args
2008-10-06 13:05:37vstinnersetstatus: open -> closed
resolution: duplicate
messages: + msg74369
nosy: + vstinner
2008-10-06 13:01:57Govindcreate