I am writing a simple code, and seek to do something which I don't know whether it is possible or not.
First, I have a name list:
Name_List = ["Jake", "Steve", "Adam"];
The first thing I'd like to do is open a separate file for each name in the name list. For example, I'd like to have three files open, Jake.bed, Steve.bed, Adam.bed Not sure how to do this, because if I say something like:
for name in Name_List: file=open(name, 'a')
Won't that just open one file, then overwrite it immediately, then overwrite it immediatly once more? Essentially, how do I open all three files at once, with separate names.
Secondly, I need to parse a large data file and search the 10th column for names found on the name list. Instead of searching with a simple loop, which would search the entire file for the name "jake" then the entire file for "Steve" etc... I want to be able to search for "jake" or "steve" or "Adam" in one sweep. This way, if my name list is 50 names, I only have to sweep the file once, instead of fifty times.
Is this possible as well? I have no idea how to tell the computer "for any name on the namelist, match..."