import os
import csv

OUTPATH = 'output/'

with open('pastes.csv', 'r') as fp:
    reader = csv.reader(fp)
    for paste_id, paste_title, paste_content, paste_created_at, paste_updated_at, paste_author in reader:
        escaped = paste_title.replace('/', '_') # might need something a little more complex on Windows
        with open(os.path.join(OUTPATH, f"{paste_id}_{paste_author}_{escaped}.txt"), 'w') as fp:
            fp.write(paste_content.encode('utf-8')) # might not need the encode
