scanf in python
amdescombes at gmail.com
Fri Jul 25 12:43:17 CEST 2008
> In message <4884e77a$0$29405$426a74cc at news.free.fr>, AMD wrote:
>> Actually it is quite common, it is used for processing of files not for
>> reading parameters. You can use it whenever you need to read a simple
>> csv file or fixed format file which contains many lines with several
>> fields per line.
> I do that all the time, in Python and C++, but I've never felt the need for
> a scanf-type function.
I agree scanf is not a must have function but rather a nice to have
> For reading delimited fields in Python, you can use .split string method.
Yes, that is what I use right now, but I still have to do the conversion
to integers, floats, dates as several separate steps. What is nice about
the scanf function is that it is all done on the same step. Exactly like
when you use % to format a string and you pass it a dictionary, it does
all the conversions to string for you.
More information about the Python-list