Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A code writer, but not a PYTHON Programmer

Status
Not open for further replies.

PerryG

Programmer
Aug 15, 2000
75
US
We get supplier data dumps from our suppliers about twice a month as text files. Some of these dumps can have 50 to 80 fields in them, of which we use approximately 30 in a std. text format file. Rather than have people do the ugly cut-n-paste thing, I'd like to develop something that can read in the supplier text file and output just what we need in the proper format. From reading my Python book, this seems like something that should be manageable. I guess I'm just looking for suggestions on where to start with this and a general rating of complexity from 1 to 10.........like 1="my 5 yr. old could do this" to 10="Are you insane? Walk away from this!"

Thanks for the input.

Perry
 
I'd say it's a complexity of about 3.

Take a look at my last reply to this posting:
Import the csv module, open the file and iterate over it, you'll get all your fields in an array to manipulate however you please. If all you want to do is output a subset of the fields with fixed offsets, I'd say it would take about 8 lines of code.
 
Thanks, Eric.

Hmmm, a 3? I was really expecting it to be a 1.

I appreciate your feedback.

Perry
 
You must have a very smart 5 year old. I was at least 7 before I could have written this.
 
Thanks.

Actually, my 5 year old is 25 years old and a first year law student. He is pretty smart........but he doesn't write code.

If you were writing this at 7, I'd say you were a pretty bright child yourself.

Keep up the good work, and thanks again for the help.

Perry
 
The CVS module handles this 4 field example correctly:

1,brunson,Eric Brunson,"Favorite Quote, I don't have one"

splitting on comma would incorrectly split it into 5 fields.

You would know this if you read the posting I linked to.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top