Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- output_file = open("output1.txt", "w")
- with open("words_466000.txt", "r") as input_file:
- words_count = 0.
- iter_counter = 0.
- not_alpha = 0
- for text_line in input_file:
- if iter_counter >= 10**8:
- break
- else:
- iter_counter += 1
- if len(text_line) == 6: #12345\n
- if text_line[:-1].isalpha(): #12345
- words_count += 1
- output_file.write(text_line.lower() + '\n')
- print "words_count: ", words_count
- print "iter_counter: ", iter_counter
- print "percent of all words: ", words_count / iter_counter
Advertisement
Add Comment
Please, Sign In to add comment