v = vi nod-u
I want to split this string to get it < / P>
L = [vi], [nid], [u]
l.split ("") is divided on the basis of space.
And I do not know how to use regular expression import function properly Can anyone explain how to do this?
Are you trying to split the string to get the word? If so, try the following:
& gt; & Gt; & Gt; Import re & gt; & Gt; & Gt; Pattern = re.compile (r '\ w +')> & gt; & Gt; & Gt; Pattern.split ('vi nod-u') ['vi', 'nod', 'u']
Comments
Post a Comment