Itertools Python3

Chris Angelico rosuav at gmail.com
Tue Aug 30 07:01:22 EDT 2016


On Tue, Aug 30, 2016 at 8:45 PM, Smith <smith at smith.com> wrote:
> Il 30/08/2016 12:28, Chris Angelico ha scritto:
>>
>> 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
>
>  python3 toolgen.py
> Inserisci un valore:  dog
> <_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'> ddd
> <_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'> ddo
> <_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'> ddg
> ...

So it's not giving you an exception, just outputting to the screen
instead of the file. Okay. Next thing to look into: How does the print
function actually get told about a file to output to? You can type
help(print) at the interactive prompt, or look in the docs online:

https://docs.python.org/3/library/functions.html#print

Check how you're using that function, because it doesn't seem to be
doing what you expect.

ChrisA



More information about the Python-list mailing list