I have a text file called CustomerList.txt
and it looks like this
134998,Madison,Foxwell,825 John Street,Staunton,VA,24401,6655414998
The end result should be like this
with open("CustomerList.txt", "r") as fin:
ID, Firstname, Lastname, Address, City, State, Zip, Phone = zip(*[l.split() for l in fin.readlines()])
That's what I have so far, but I get an error that says I need more than 3 values to upack. I just started using tuples yesterday so please keep things as basic as possible for this newbie. If you could include an explanation as to why it worked that would be great!
Step 1: Each line in the data file should become a tuple in a list of tuples (or a list within a list). It would need to be before what I created in the last program which is this.
Step 2: Inside of the returning function I'll need to get a ID number (like 134998) to search for a match and if a match is found return it as a tuple/list if not return an empty tuple/list. They can be strings because they aren't calculations.