when does multiple commands cross the for loop?

You seem to be pushing your code in all the wrong directions. You need to learn how to debug small programs.

With data processing like this you should print out the results as you go and you will see what the data looks like at each stage.

Perhaps you meant this:

#Open the .dat file (in Python)
Poly = open('poly.dat','r')
#Loop over each line of poly.dat.
for replace in Poly.readlines():
    replace = replace.strip()
    if replace:
        replace = replace.replace('(','').replace(',','').replace(')','')
        x,y = replace.split()

Update: Used strip() to clean up blank lines.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top