Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/python
import sys
nc = 0
f = open("paths.lst","r")
for l in f.readlines():
data_text = l.rstrip().split(" d=\"")
if len(data_text) <= 1:
print l.rstrip()
continue
data_text2 = data_text[1].split("\"")[0]
SAVE_lefttext = data_text[0] + " d=\""
SAVE_righttext = "\"".join(data_text[1].split("\"")[1:])
tokens = data_text2.split(" ")
start_x,start_y = tokens[1].split(",")
tokens_save = "%s %f,%f" % (tokens[0],float(start_x) + 50.0 * nc,float(start_y))
nc += 1
# print len(tokens)
for t in tokens[2:]:
# print t
if "," in t:
(n1,n2) = t.split(",")
f_n1 = float(n1)
f_n2 = float(n2)
tokens_save += " %f,%f" % (f_n1 * 1000.0,f_n2 * 1000.0)
else:
tokens_save += " " + t
print SAVE_lefttext + tokens_save + "\"" + SAVE_righttext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment