quick question
Daniel Bickett
dbickett at gmail.com
Mon Mar 7 19:46:25 EST 2005
If you simply wanted to get rid of quotes entirely, you could use:
"\"Hello!\"".replace( "\"" , "" )
However, since you only want the beginning and ending quotes removed:
>>> string = "\"If thou wert my fool, nuncle...\""
>>> print string
"If thou wert my fool, nuncle..."
>>> if string.startswith("\""): string = string[1:]
>>> print string
If thou wert my fool, nuncle..."
>>> if string.endswith("\""): string = string[:-1]
>>> print string
If thou wert my fool, nuncle...
Does this suffice?
--
Daniel Bickett
dbickett at gmail.com
http://heureusement.org/
More information about the Python-list
mailing list