bruno.42.desthuilliers at websiteburo.invalid
Thu Apr 22 15:04:23 CEST 2010
luca72 a écrit :
> i get a string from a web server and i save it in to a file, that i
> open the file and i read the string:
> the string looks like :
> after the read i use webbrowser open (sting), but i get the error
> because at the end of the string are added '%0D%0A',
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
Can't tell if this comes from the source ("i get a string from a web
server") or if you (unwantingly) add it yourself when writing to or
reading from the file.
> and if i ask for
> the len of the sting it include also the"'%0D%0A".
> My question is how i can cut the last part of the string if it is
> every time different?
You'd be better fixing the problem where it happens. FWIW, str.strip()
might help here.
More information about the Python-list