I am working on a project that reads a file in which the beginning lines in each file have a letter that represents what that line is doing. For example, if the line begins with 'p' then this line contains a coordinate.
I am trying to add all the lines that begin with p in their own list. Then make the coordinates into tuples. This is the code I am running to do so:
pList=[]
if [0] in makeList is 'p':
pList=[tuple(map(int, l.split()[2:3])) for l in makeList.readlines()]
pList.append(line.strip())
My problem is when I run a diagnostic print, the list is coming back empty. I am new to programming so I am having a hard time troubleshooting this one. Thank you!
Aucun commentaire:
Enregistrer un commentaire