Q
qwweeeit
Splitting with RE has (for me!) misterious behaviour!
I want to get the words from this string:
s= 'This+(that)= a.string!!!'
in a list like that ['This', 'that', 'a.string']
considering "a.string" as a word.
Python 2.3.4 (#2, Aug 19 2004, 15:49:40)
[GCC 3.4.1 (Mandrakelinux (Alpha 3.4.1-3mdk)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Help!
I want to get the words from this string:
s= 'This+(that)= a.string!!!'
in a list like that ['This', 'that', 'a.string']
considering "a.string" as a word.
Python 2.3.4 (#2, Aug 19 2004, 15:49:40)
[GCC 3.4.1 (Mandrakelinux (Alpha 3.4.1-3mdk)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
['This', 'that', '', '', 'tring', '!']s= 'This+(that)= a.string!!!'
import re
p=re.compile('[\W].')
p.split(s)
['This', '', 'that', '', '', 'a', 'string', '', '', '']p=re.compile('[\W.]')
p.split(s)
Help!