Hi,
I don't know the version of python you use, but the following code must be
effective in python 3.5 or so:
for i in chemicals:
Draw.MolToFile(i, 'Desktop/{}.png'.format(i) )
Or you should use zip() for the for-loop to insert corresponding compounds'
names.
Best,
Shojiro
On Wed, Jul 11, 2018 at 9:04 AM Phuong Chau <[email protected]> wrote:
> Hello,
> I have a list of chemicals such as chemicals=["Cc1ccccc1",
> "C=Cc1ccccc1","CCCc1ccccc1"] and I want to use Draw.MolToFile to draw 2D
> structure image of each of them. However, I am not sure how to name it
> differently in the for loop. Like for example:
> for i in chemicals:
> Draw.MolToFile(i, 'Desktop/i.png')
>
> I want the image file name has the name of the SMILES string of that
> chemcal such as Cc1ccccc1.png. Is it possible for me to do that in the
> Python Script? or do I have to do it one by one?
>
> Thank you so much for your help!
>
> --
> Phuong Chau
> Smith College '20
> Engineering Major
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Rdkit-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss