[Solved] How to print each word of a string printed as new record?


import re
inp = open('menu.bak', "r")
outp = open('word.txt',"w")
for line in inp:
  for word in line.split():
    outp.write(str(word) + "," + "1" + '\n')
inp.close()
outp.close()

solved How to print each word of a string printed as new record?