Itertools Python3

Chris Angelico rosuav at gmail.com
Tue Aug 30 06:28:25 EDT 2016


On Tue, Aug 30, 2016 at 8:24 PM, Smith <smith at smith.com> wrote:
> I can not write to the file.
> Can someone help me?
> Thanks
>
> from itertools import product
> valore = input('Inserisci un valore:  ')
> risultato = product(valore, repeat = 3)
> with open("file.txt", "w") as result:
>         for i in risultato:
>                 print (result,"".join(i))

Do you get an exception, possibly from the product() call? When you
ask for help, copy and paste the entire traceback and error message;
it's extremely useful information.

I'm pretty sure I know what the problem is here, but I want you to
post the traceback, so that you learn how debugging of Python code
works :)

ChrisA



More information about the Python-list mailing list