Created
April 6, 2018 13:57
-
-
Save ronreiter/d6caae55254fa6d37104cecc2a596514 to your computer and use it in GitHub Desktop.
Facebook post stats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
name = None | |
in_text = False | |
current_text = "" | |
all_text = [] | |
for line in open("stats.txt"): | |
#print('current line: %s in_text: %s name: %s' % (line.strip(), in_text, name)) | |
line = line.strip() | |
if line == 'Manage' or 'Reply' in line: | |
in_text = False | |
if current_text: | |
print(current_text.strip()) | |
all_text.append(current_text.strip()) | |
current_text = "" | |
continue | |
if name and not in_text and line.startswith(name): | |
in_text = True | |
current_text += line[len(name)+1:] + " " | |
continue | |
if in_text: | |
current_text += line + " " | |
continue | |
if len(line) > 5: | |
name = line | |
count = Counter(all_text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment