C
CSUIDL PROGRAMMEr
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
thanks
cairo-2.3.4.src.rpm
Is there any way i can only get 2.3.4 from this file name
thanks
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
thanks
Chris said:I'm trying to think of a good reason to extract the version from the
filename instead of using RPM to get the real version from the
metadata and I can't come up with one.
The inquirer doesn't have any RPM handling tools installed/available or
is dealing with a lot of versioned filenames which might be a selection
of different, arbitrary formats.
Try harder! ;-)
Paul
'2.3.4'CSUIDL said: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)))
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.