※ [EMAIL PROTECTED] (Peter Otten)》之銘言:
到底在累什麼啊? wrote:
Thanks a lot! I have never thought of that.
But what if there's not only commas, but also periods and semicolons? I
want to find words between 2 near by punctuations. I think it would make
it difficult to use split instead of regular
※ [EMAIL PROTECTED] (Thomas Nelson)》之銘言:
How about
my_string = We the people of the United States, in order to form a
more perfect union, establish justice, insure domestic
tranquility,..
print (x for x in my_string.split(,) if justice in x).next()
This isn't a regular expression, but it
I want words between 2 nearby commas with a specific word in them.
For example,in the text blow:
We the people of the United States, in order to form a more perfect union,
establish justice, insure domestic tranquility,..
I want justice and the words between the 2 nearest commas, which is