scanf in python...?
Steve Clift
sgclift at earthlink.net
Wed Oct 18 01:37:38 EDT 2000
More information about the Python-list mailing list
Wed Oct 18 01:37:38 EDT 2000
- Previous message (by thread): scanf in python...?
- Next message (by thread): scanf in python...?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Terry Reedy" <tjreedy at udel.edu> wrote: > "Tony Waterman" <tonyw54 at home.com> wrote in message >> Does python have any way to mimic scanf ? I just bought Python on >> Win32 and I can't find anything in there about it, or on the >> python.org html tutorial. Also; how many ways to mimic scanf are >> there? > > xscanf(x, format, pointer1, pointer2, .... pointern) is not directly > possible in Python because Python does not have pointers. > > However, it would be possible to write a scan(string,format) function that > would return a tuple of values. Since Python uses C formats for the % > operator, it would add a nice symmetry. [IE, scan(format%tuple,format) == > tuple]. That's approximately what the sscanf module I wrote about 5 years ago does (I got fed up with all the hooplah involved in reading tables of mixed data types using the standard Python facilities). You can find it by doing a web search on sscanfmodule.c. I have no way of compiling it to be useful under Windows, unfortunately. Steve
- Previous message (by thread): scanf in python...?
- Next message (by thread): scanf in python...?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list