Hi
I get a littel problem to read,sort,count and remove punctuation marks from text file.
data="""I love the python programming
How love the python programming?
We love the python programming
Do you like python for kids?
I like Hello World Computer Programming for Kids and Other Beginners."""
##f = open ("data.txt", "r")
##lines = f.readlines()
##print lines
count = {}
for word in sorted(data.split()):
if word in count:
count[word] += 1
else:
count[word] = 1
print count
>>> ================================ RESTART ================================
>>>
{'and': 1, 'Do': 1, 'We': 1, 'Kids': 1, 'love': 3, 'like': 2, 'programming?': 1, 'How': 1, 'I': 2, 'Programming': 1, 'programming': 2, 'for': 2, 'Hello': 1, 'python': 4, 'Computer': 1, 'World': 1, 'the': 3, 'kids?': 1, 'Other': 1, 'you': 1, 'Beginners.': 1}
>>>
How can I read from data.txt?