-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcsvToText.py
More file actions
25 lines (23 loc) · 726 Bytes
/
csvToText.py
File metadata and controls
25 lines (23 loc) · 726 Bytes
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
import csv
import pandas as pd
rows = []
max_file_number = 38
file_count = 1
second_count = 1
for i in range(max_file_number):
print("Iteration #"+str(i))
print("File #"+str(file_count))
row_count = 0
with open(f'./tweets/return_{file_count}.csv', 'r') as fileC:
csvreader = csv.reader(fileC)
row_count = sum(1 for row in csvreader)
with open(f'./tweets/return_{file_count}.csv', 'r') as fileC:
csvreader = csv.reader(fileC)
with open(f'./tweets/text/text_{second_count}.txt', 'w', encoding='utf-8') as f:
print("Txt file #"+str(second_count))
for i in range(row_count-1):
#print("Row "+str(i))
f.write(next(csvreader)[1].replace('\n',' '))
f.write('\n')
second_count += 1
file_count +=1