mostcommonwords
![[파이썬] Most Common Words 가장 자주 사용된 단어 추출](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2Fb8fWIM%2FbtrC1hrrTbc%2FAAAAAAAAAAAAAAAAAAAAALha7F_GoosuvCJ76bq3F6LQ7FgbXHQrC1gUX8Pi0RXP%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DX0jRzJdAhFJ%252B6bDxcQgIJTVO%252Bfc%253D)
[파이썬] Most Common Words 가장 자주 사용된 단어 추출
[파이썬] Most Common Words 인자로 받은 txt 파일에서 가장 자주 나온 단어 순으로 출력하는 프로그램ximport sysfrom collections import Counter try: num_words = int(sys.argv[1]) #두번째 인자except: print("usage: most_common_words.py nuim_words") sys.exit() counter = Counter(word.lower() for line in sys.stdin for word in line.strip().split() if word)for word, count in counter.most_common(num_words): sys.stdout.write(str(count)) sys.std..