Formatted input function

Günther Dietrich gd_usenet at spamfence.net
Sat Sep 5 19:50:18 CEST 2009


candide <candide at free.invalid> wrote:

>In C, we would manage this with the following statement :
>
>fscanf(foo_file, "Best score : %d", &score);
>
>Does Python provide an equivalent ?

RTFM!  :)

In the python 2.5 manual: Chapter 4.2.6 (search pattern 'scanf' on the 
index tab of python25.chm)

There are some scanf-patterns with corresponding regular expressions 
listed.

Works quite nice.



Best regards,

Günther



More information about the Python-list mailing list