-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcombine.py
37 lines (27 loc) · 1.01 KB
/
combine.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
'''
This python program will take two files of dehydrated tweets and merge them. To
use this program, download it from Github and store it in your twarc utilities
file.
Usage: python utils/combine.py
Takes user input of the following:
file1 -
file2 -
output -
Each id must be on a separate line in the original tweet file for this to work. The program reads line by line.
'''
file1 = input("Enter the name of your filter txt: ")
file2 = input("Enter the name of your search txt: ")
output = input("Enter the name of your output txt: ")
filenames = [file1, file2]
# Open file3 in write mode
with open(output, 'w') as outfile:
# Iterate through list
for names in filenames:
# Open each file in read mode
with open(names) as infile:
# read the data from file1 and
# file2 and write it in file3
outfile.write(infile.read())
# Add '\n' to enter data of file2
# from next line
outfile.write("\n")