scanf in python
castironpi
castironpi at gmail.com
Sun Aug 3 10:00:16 EDT 2008
On Aug 3, 8:27 am, "tutu... at gmail.com" <tutu... at gmail.com> wrote:
> On Jul 22, 2:00 pm, AMD <amdescom... at gmail.com> wrote:
>
> > Hello Fredrik,
>
> > I didn't think my comment would offend anyone [...]
>
> I doubt that it offended anyone else. Having been the recipient of a
> few F-bombs :-) myself, I'd just let it go by...
>
> Mike
The regular expression module (re) should be pretty handy at this.
This may not be a typical case, but:
>>> re.match( r"([0-9]+) ([0-9]*.?[0-9]+) (.{1,5})", '1 2.02 abcde' ).groups( )
('1', '2.02', 'abcde')
The float catcher doesn't catch "2." If you need that to work or
other classes, speak up.
More information about the Python-list
mailing list