[Tutor] A Multiple Concatenation Problem
Stephen P. Molnar
s.molnar at sbcglobal.net
Thu Sep 17 14:35:11 EDT 2020
On 09/17/2020 02:00 PM, Alan Gauld via Tutor wrote:
> On 17/09/2020 18:54, Mats Wichmann wrote:
>
>>>>> for suf in range(1, 11):
>> ... filename = f"<ligand>{suf}.log"
>> ... print(filename)
>> ...
>> <ligand>1.log
>> <ligand>2.log
>> <ligand>3.log
>> <ligand>4.log
>> <ligand>5.log
>> <ligand>6.log
>> <ligand>7.log
>> <ligand>8.log
>> <ligand>9.log
>> <ligand>10.log
>
> In case that's not clear, Mats is using the new
> format-string notation.
> You can use the old style format strings similarly:
>
> fmt = "<ligand>.%d.log"
> for suf in range(1,11):
> print(fmt % suf)
>
> Or append to a list or...
> rather than print...
>
Many thanks for the replies.
--
Stephen P. Molnar, Ph.D.
www.molecular-modeling.net
614.312.7528 (c)
Skype: smolnar1
More information about the Tutor
mailing list