diff options
Diffstat (limited to 'progs/a261.py')
-rw-r--r-- | progs/a261.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/progs/a261.py b/progs/a261.py new file mode 100644 index 0000000..b5592b1 --- /dev/null +++ b/progs/a261.py @@ -0,0 +1,6 @@ +from collections import Counter
+import re
+def n_common_words(text,n):
+ words = re.findall('\w+',text)
+ n_common_words= Counter(words).most_common(n)
+ return list(n_common_words)
\ No newline at end of file |