Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __author__ = 'vaishali'
- import collections
- import os
- import commands
- file_input = open("example.txt","r+")
- d = collections.defaultdict(int)
- for k in file_input.read().split():
- d[k] +=1
- P = dict(d)
- keys = P.keys()
- values = P.values()
- os.makedirs("my_output",mode = 0777)
- for i in keys:
- file_name = open("/root/my_output/%s" %i,'w')
- file_name.write("%s" %P[i])
- #commands.getoutput("cp %s my_output" %i)
Add Comment
Please, Sign In to add comment