Re: parsing a file name

2007-01-12 Thread Roberto Bonvallet
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(

Re: parsing a file name

2007-01-12 Thread Chris Mellon
On 12 Jan 2007 10:23:41 -0800, Paul Boddie <[EMAIL PROTECTED]> wrote: > Chris Mellon wrote: > > > > 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 doe

Re: parsing a file name

2007-01-12 Thread Paul Boddie
Chris Mellon wrote: > > 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 ve

Re: parsing a file name

2007-01-12 Thread Chris Mellon
On 12 Jan 2007 09:16:51 -0800, CSUIDL PROGRAMMEr <[EMAIL PROTECTED]> 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 > thanks > > -- > http://mail.python.org/mailman/listinfo/python-list > I'm trying to think of a good reason to extract

Re: parsing a file name

2007-01-12 Thread Tim Williams
On 12 Jan 2007 09:16:51 -0800, CSUIDL PROGRAMMEr <[EMAIL PROTECTED]> 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 Is this a one off, or do you have to process multiple files with similar names? -- Tim Williams -- http://mail.pyt

parsing a file name

2007-01-12 Thread 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 -- http://mail.python.org/mailman/listinfo/python-list