CSUIDL PROGRAMMEr wrote: > I have a filename > cairo-2.3.4.src.rpm > Is there any way i can only get 2.3.4 from this file name
>>> a = "cairo-2.3.4.src.rpm"
>>> import re
>>> re.compile(r"\d+([.]\d+)*").search(a).group(0)
'2.3.4'
>>> a.split("-")[-1][:-len(".src.rpm")]
'2.3.4'
>>> ".".join(map(str, range(2, 5)))
'2.3.4'
--
Roberto Bonvallet
--
http://mail.python.org/mailman/listinfo/python-list
