Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- #declare sum variable
- sum = 0
- #create file object that opens the given argument in read mode
- fob = open(sys.argv[1], 'r')
- #insert the large text file into variable data as a string
- data = fob.readlines()
- newdata = []
- for s in data:
- s = s.strip().split(',')
- for t in s:
- newdata.append(t.strip())
- removedata = newdata
- removedata = list(set(removedata))
- d = {}
- for s in removedata:
- d[s] = newdata.count(s)
- print(newdata)
- print(d)
Add Comment
Please, Sign In to add comment