Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def to_csv():
- with open('data_set.csv', 'w', newline='', encoding='utf-8') as csvfile:
- translator = str.maketrans('', '', string.punctuation)
- writer = csv.writer(csvfile, delimiter=',')
- rows = []
- for i in range(1, 1):
- try:
- file = open("false_text_files/" + str(i) + ".txt", "rb")
- text = file.read().decode().translate(translator)
- except:
- continue
- row = ['no', text]
- rows.append(row)
- for u in rows:
- print(u[1])
- writer.writerow(u)
Add Comment
Please, Sign In to add comment