I am new to Python. I have input in this format
Harry is American Harry is American Harry is American Harry is American
Harry is American Harry is American Harry is American Harry is American
Harry is American Harry is American Harry is American Harry is American
And my output should should like this
Harry, 1
is, 1
American, 1
Harry, 1
is, 1
American, 1
....
Can you please tell me the solution...
I am trying with below code(my code was not even closer to the solution).
import sys
import re
inp = open('menu.bak', "r")
outp = open('word.txt',"w")
for line in inp:
counts = len(re.findall(r'\w+', line))
new = ''.join(line)
print(new[0])
print(new[1])
inp.close()
outp.close()
Thanks, Gokul S