scanf in python?
Bob and Deb
bobdebm at gmail.com
Wed Feb 20 14:45:30 EST 2008
Hello python-list,
This is my first post and yes I am a python newbie :-)
I've been trying to figure out how to convert an old database dump into a
form that can be imported into Postgresql. The file (dealing with one
table) looks something like this:
create table table1 (id int, name char(20), agw_map char(14), agw real)
id 1 11 name 13 32 agw 34 47
6195 000036_00195 26.728
6188 000036_00188 31.905
6217 000036_00223 19.644
6078 000036_00024 38.055
6079 000036_00025 37.678
6080 000036_00027 40.03
6081 000036_00028 38.884
6082 000036_00030 43.616
6083 000036_00032 46.548
6084 000036_00033 48.593
6085 000036_00036 53.764
****** End of Table ******
In C I could build a format string (using info from the table create
statement and the column position in the header) and use scanf to parse this
file. What does the Python solution looks like?
Thanks in advance.
Bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080220/46324d76/attachment.html>
More information about the Python-list
mailing list