Python regular expression question
guettli at thomas-guettler.de
Mon Jun 9 13:47:53 CEST 2003
On Sun, Jun 08, 2003 at 07:34:27PM +1000, DJ wrote:
> I cant figure out a re that matches a string in a sentance.
> The string can be anywhere in the sentance
> I walked my dog today
Maybe \w* is what you are looking for:
sentence="I walked my dog today"
#skip empty strings:
for word in words:
if not word:
['I', '', 'walked', '', 'my', '', 'dog', '', 'today', '']
Thomas Guettler <guettli at thomas-guettler.de>
More information about the Python-list