'How to create individual .txts based on a column with as content the info of two (other) columns?
For my studies, I have to work with various archival files and I am lucky that I to already have metadata in a .csv file. When I work with the individual archival files that I am currently manually going through, I want to make notes. When I am in a later phase, I want to filter with my .csv and then have Python provide me with the selected .txts. As there are 5000 archival files, I do not want the aditional information to become part of my original .csv as I may not always need all the information (+ it might become messy).
What I now need is from my dataoverview.csv the following things:
- I have a column "Filereference" which Looks like "BER.01.001.0001.txt" (and then "BER.01.001.0002.txt) --> these need to become individual .txt files
- The content of these files needs to become a phrase "Law Number: [info from matching cell in column LAWID" and
- The content of the matching cell "Title" with the phrase "Title: [info from that specific cell] (and then preferably an enter)
I have tried, but I get stuck every single time. Someone here who knows how to do this quickly?

import os
import fileinput
dire = "directory"
# function for converting csv files to txt
def csv_to_txt(names, txtfilename):
but that's far from what I want to get as an output... so I am not really far
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
