how to determine an 'open' string?
John La Rooy
larooy at xtar.co.nz
Thu May 16 17:00:25 EDT 2002
On Thu, 16 May 2002 18:59:17 +0200
holger krekel <pyth at devel.trillke.net> wrote:
>
> i think that's it. very nice!
>
> i might try to shorten it a bit, though :-)
>
> thanks,
>
> holger
>
>
is this short enough for you?
import re
def quoteopen(s):
quot=re.compile("(?P<quot>\"\"\"|'''|\"|').*?(?P=quot)")
s=quot.sub("",s)
return "'" in s or '"' in s
John
More information about the Python-list
mailing list