[Tutor] A Multiple Concatenation Problem
Mark Lawrence
breamoreboy at gmail.com
Sat Sep 19 17:36:37 EDT 2020
On 19/09/2020 22:09, Stephen P. Molnar wrote:
>
> input output
> <ligand> ----> ligand .i.log where i in range(1,11)
>
So you want:-
ligand1.1.log
ligand1.2.log
ligand1.3.log
...
ligand31.8.log
ligand31.9.log
ligand31.10.log
in which case you need nested loops something like:-
filenames = []
with open('Ligand.list') as infile:
for ligand in infile:
for suf in range(1, 11):
filename = f"{ligand[:-1]}.{suf}.log" # IIRC how to strip
EOL :)
filenames.append(filename)
print(filename)
Have we got there?
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
More information about the Tutor
mailing list