[Tutor] strings matching problem

Alan Gauld alan.gauld at blueyonder.co.uk
Fri Aug 8 09:01:16 EDT 2003


> Like .abc ,  .abc#1 ,  .abc#2
>
> I want that if i encounter such kind of name then it should be
converted to
> .abc

string.split('#') will do that for you:

>>> print 'abc#2'.split('#')[0]
'abc'

Alan G.





More information about the Tutor mailing list