remove special characters from line
Alan Kennedy
alanmk at hotmail.com
Tue Jul 1 11:54:55 EDT 2003
[Chris Rennert]
> If I have a line like this
>
> ²blah blah blah blah blah
>
> I know I could do a slice like this [1:] to pull everything but the
> special character, but what if I have several lines in a file.
> I am not sure how I would detect a special character like that. I
> would just like to pull everything from those lines (and the special
> character always appears as the first character, but not on every line)
> except for the special characters.
How about something like this?
for line in file('myfile.stars'):
print line.lstrip('*')
Should remove all '*' (even if there is more than one) from the beginnings (but
not the ends) of lines.
Egor Bolonev wrote:
> I didn't get what you're talkink about.
Then what was the purpose of your reply?
I find it helps keeps the signal noise to ratio of the group down if people only
post when they have something to contribute.
regards,
--
alan kennedy
-----------------------------------------------------
check http headers here: http://xhaus.com/headers
email alan: http://xhaus.com/mailto/alan
More information about the Python-list
mailing list