[Tutor] Comparing a string
Jonas Melian
jonasmg at softhome.net
Sat May 21 05:16:33 EDT 2005
Alan G wrote:
>>I'm tryin compare a string with a value with style of
>
> Use regular expressions and turn it around:
>
> import re
> s = 'i686'
> ex = re.compile('i?86')
> if ex.match(s): print 'they match!'
>
> Is that what you mean?
>
> Alan G.
>
>
Thanks, that's the way. But in a expression regular ('i?86') it would be:
('i[0-9]86') or ('i\d86') for match a number
More information about the Python-list
mailing list