So I'm pretty new to using python and a beginner. I've written a code on how to figure out the length of 2 polylines and now I'm trying to figure how to display the data using canvas... I've tried like a million times and I just can't get it to work. Can somebody help me out?

Heres my code for the polylines:

```
from math import *
def distance(p1, p2):
x=[0,0]
y=[0,0]
x[0] = float(p1[0])
x[1] = float(p1[1])
y[0] = float(p2[0])
y[1] = float(p2[1])
i = 0
xx=x[0]-y[0]
yy=x[1]-y[1]
d=sqrt(pow(xx,2)+pow(yy,2))
return d
try:
f = open("C:\line1.txt","r")
txt = f.read()
data = txt.split('; ')
f.close()
f = open("C:\line2.txt","r")
txt2 = f.read()
data2 = txt2.split('; ')
f.close()
#f.readlines()
#f.seek(0)
#f.read()
#f.write("this is a test")
f.close()
except:
print "there are errors"
#file1
i=0
polyline1=[None]*(len(data)-1)
while i < len(polyline1):
polyline1[i] = data[i].split(',')
i = i+1
#file2
i=0
polyline2=[None]*(len(data2)-1)
while i < len(polyline2):
polyline2[i] = data2[i].split(',')
i = i+1
i=0
distance1 = 0
while i < len(polyline1)-1:
distance1 += distance(polyline1[i],polyline1[i+1])
i = i+1
print "Distance of the first polyline is %s" %distance1
i=0
distance2 = 0
while i < len(polyline2)-1:
distance2 += distance(polyline2[i],polyline2[i+1])
i = i+1
print "Distance of the second polyline is %s" %distance2
```

Here are the two polylines I'm doing. They were in text files. Line 1 & Line 2.

Line 1: 1603714.835939442,142625.48838266544; 1603749.4678153452,142620.21243656706; 1603780.3769339535,142607.37201781105; 1603801.475846678,142582.27024446055; 1603830.4767344964,142536.14692804776;

Line 2: 1602514.2066492266,142330.66992144473; 1602521.4127475217,142414.92978276964; 1602520.1146955898,142433.93817959353; 1602501.3840010355,142439.12358761206; 1602371.6780588734,142417.84858870413; 1602351.6610373354,142408.02716448065; 1602334.5180692307,142388.58748627454; 1602331.6999511716,142376.66073128115; 1602334.8067251327,142348.965322732; 1602338.308919772,142323.6111663878; 1602349.0226452332,142314.50124930218; 1602363.9090971674,142310.79584660195; 1602514.2066492266,142330.66992144473;