Python "Bad syntax"

Phil Boutros philb at philb.ca
Mon Feb 5 12:32:25 EST 2018


Phil Boutros <philb at philb.ca> wrote:
>
>     Which version of python are you using?  That syntax for "print"
> started in python 3 (since print became a function).  
>
> Try adding:
>
> from __future__ import print_function
>
> before your code if you're still using python 2.x

    Altough, testing it in Python2, it still works, but it prints the
tuples, of course.

    As Christian said, I suspect this is an indent error of sorts.

    Manually typing your code with correct indents, I can verify that
it works in both Python 2 and 3 (with various results depending on
which version of print is used, of course.)


Phil
-- 
AH#61  Wolf#14  BS#89  bus#1  CCB#1  SENS  KOTC#4
philb at philb.ca  http://philb.ca



More information about the Python-list mailing list