-
-
Save arcolife/5864370 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def doit(text): | |
import re | |
matches=re.findall(r'\"(.+?)\"',text) | |
#matches1= re.findall(r'(.+?)\"',text) | |
# matches is now ['String 1', 'String 2', 'String3'] | |
print matches | |
return ",".join(matches) | |
q='"Terrified, mortified, petrified, stupified by you." said John Nash, "alright"' | |
x = doit(q) | |
print x,"\n" | |
''' | |
if(doit(i)): | |
print "found it at ",q.index(i) | |
print "\nBTW, no. of tokens were",len(q) | |
print "Ok, tokens are: ",q | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment