Skip to content

Instantly share code, notes, and snippets.

@loansindi
Created June 11, 2014 14:05
Show Gist options
  • Save loansindi/0de0a40a6624ff4904db to your computer and use it in GitHub Desktop.
Save loansindi/0de0a40a6624ff4904db to your computer and use it in GitHub Desktop.
f = open("words.txt")
o = open("output.txt", "w")
x = f.read()
y = x.split("\n")
j = "cantaloupe"
c = 1
o.write("graph G{\n")
for i in y:
c = c + 1
o.write("%s -- %s;\n" %(i, j))
if c%2 == 0:
j = i
# "{word} -- {foo};\n".format(word=i,foo=j)
o.write("}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment