I have a problem. I have a csv that stores data about checks in a private restaurant . Not CC's or anything, just table number, items, server number, blah. It repeats for every check a four lines that start with 1,4,5,6,7. I have a interface that picks up this csv and reads line four to help billing guests. It was written in VB, it will not be re-written by the programmers. I need the data from line 7 to be in the line four position. I was looking over the csv reader and writer objects, but I can't wrap my head around this. Any ideas? Thank you so much in advance.
TheNational22 9 Light Poster
Recommended Answers
Jump to PostHuh? Not exactly sure what you mean, but if the csv writer confuses you, just write to it like this:
csvfile = open('myrestaurant.csv','w') csvfile.write('Server,Table,Items,Bill\n') csvfile.write('Gary,10,4,$40') csvfile.close()
As far as I know, csv files are just text files of comma delimited strings. one line = one row.
Jump to PostMy personal preference would be using a dictionary since it would be indexed on the number, but there are several ways to do this along the lines of the following. Add the recs to a dictionary. When a 7 is found, send the dictionary to a function to process. If …
All 5 Replies
zachabesh 5 Junior Poster
jlm699 320 Veteran Poster
TheNational22 9 Light Poster
woooee 814 Nearly a Posting Maven
zachabesh 5 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.