Goodbying Spaces

Victor Subervi victorsubervi at gmail.com
Fri Apr 25 17:01:31 EDT 2008


 Hi;
Whenever I call a field from the preceeding form using cgi.FieldStorage() I
get a space on either side. I end up writing code like this to get rid of
that space:

try:

  if id[0] == ' ':

  id = id[1:len(id)]

except:

  pass

try:

  if id[len(id) - 1] == ' ':

  id = id[0:len(id) - 1]

except:

  pass
which is a nuisance. Is there a better way to do this? I have tried
id.strip() with no luck. What do?
TIA,
Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080425/32fddb66/attachment.html>


More information about the Python-list mailing list