-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocess_old.py
37 lines (32 loc) · 979 Bytes
/
process_old.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
followers_file = open('test_input', 'r')
followers_string = followers_file.read()
followers_list = followers_string.split('\\n')
pretty_list = []
counter = 0
list_len = len(followers_list)
for x in range(0, list_len):
if counter + 1 > list_len:
break
if followers_list[counter + 1] == 'Follow' or followers_list[counter + 1] == 'Following':
pretty_list.append(
[
followers_list[counter],
'',
followers_list[counter+1]
]
)
counter = counter + 2
else:
pretty_list.append(
[
followers_list[counter],
followers_list[counter + 1],
followers_list[counter + 2]
]
)
counter = counter + 3
file = 'followers/first'
with open(file, 'w') as f:
for item in pretty_list:
string_to_print = '{} {} {}\n'. format(item[0], item[1], item[2])
f.write(str(item))