Thanks bvdet!
This does seem to read in everything from the text files directly, regardless of the white-space padding.
Now I just need to figure out how to integrate it into the rest of my code so that the data is written to the SQL database correctly. I am a newbie to Python, so it sometimes takes me a while to figure out how I need to proceed. If I can though, I want to figure out how to tweak my code myself to use your solution,...
User Profile
Collapse
-
Hi BV,
Attached is a small sample of one of the text files (I tried copying and pasting it below, but it actually messed up the format). The problem is that some of the columns contain position data (lat, long). In some cases, the lat and long are negative, and in others they are positive. This means that not only does the number of units in each entry change as position changes, but also some entries have a '-' in front of them. These entries...Leave a comment:
-
repeated delimiters with cvs.DictReader
Hi All,
Just a quick question. I have some text files that are space-delimited. Some of the columns in this file have been padded with zeros so that when you open the text file in a simple text editor, the columns all line up and it is easy to read. I am using csv,DictReader to read in the files, so that it automatically generates a dictionary based off the first row. The problem is that when I read this file in with csv.DictReader, I end...
No activity results to display
Show More
Leave a comment: