Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

str.split unintentionally strips char 'I' from the string #48303

Closed
Govind mannequin opened this issue Oct 6, 2008 · 2 comments
Closed

str.split unintentionally strips char 'I' from the string #48303

Govind mannequin opened this issue Oct 6, 2008 · 2 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@Govind
Copy link
Mannequin

Govind mannequin commented Oct 6, 2008

BPO 4053
Nosy @vstinner

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2008-10-06.13:05:37.874>
created_at = <Date 2008-10-06.13:01:57.903>
labels = ['type-bug', 'library']
title = "str.split unintentionally strips char 'I' from the string"
updated_at = <Date 2008-10-06.13:05:37.860>
user = 'https://bugs.python.org/Govind'

bugs.python.org fields:

activity = <Date 2008-10-06.13:05:37.860>
actor = 'vstinner'
assignee = 'none'
closed = True
closed_date = <Date 2008-10-06.13:05:37.874>
closer = 'vstinner'
components = ['Library (Lib)']
creation = <Date 2008-10-06.13:01:57.903>
creator = 'Govind'
dependencies = []
files = []
hgrepos = []
issue_num = 4053
keywords = []
message_count = 2.0
messages = ['74367', '74369']
nosy_count = 2.0
nosy_names = ['vstinner', 'Govind']
pr_nums = []
priority = 'normal'
resolution = 'duplicate'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue4053'
versions = ['Python 2.5']

@Govind
Copy link
Mannequin Author

Govind mannequin commented Oct 6, 2008

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

@Govind Govind mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Oct 6, 2008
@vstinner
Copy link
Member

vstinner commented Oct 6, 2008

Duplicate of bpo-4054.

@vstinner vstinner closed this as completed Oct 6, 2008
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant