[Tutor] Problem with print

David Hutto smokefloat at gmail.com
Tue Dec 21 05:35:41 CET 2010


On Mon, Dec 20, 2010 at 5:15 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> David Hutto wrote:
>>
>> On Sun, Dec 19, 2010 at 4:33 PM, Hugo Arts <hugo.yoshi at gmail.com> wrote:
>>>
>>> On Sun, Dec 19, 2010 at 10:11 PM, Sander Sweers <sander.sweers at gmail.com>
>>> wrote:
>>>>
>>>> On 19 December 2010 21:54, jtl999 <jacksmoo111 at gmail.com> wrote:
>>>>>
>>>>>  File "GettingStarted.py", line 91
>>>>>   print ("Lesson Two")
>>>>>       ^
>>>>> SyntaxError: invalid syntax
>
> [...]
>
>> Apparently so, but I'd like to see the full code to know what caused
>> the error to point to print.
>
> It is very common for an error in parentheses or brackets to lead to a
> syntax error on the following line.
>
>>>> compile("""
> ... x = 1
> ... y = (x+1/2
> ... z = 3
> ... """, "", "exec")
> Traceback (most recent call last):
>  File "<stdin>", line 5, in <module>
>  File "", line 4
>    z = 3
>    ^
> SyntaxError: invalid syntax

I was used to the tutorials from 3 showing the correct print(), and
seeing the errors for print 'whatever', when i accidentally used them
in 3, that I used them exclusively after seeing the 3 tutorials, and
that it could be used as both a function and a statement(correct me if
the term is wrong) in 2.

It's important to note that had the op provided some code to go along
with the error, that it might have been spotted more sooner by a less
experienced eye.

>
>
> --
> Steven
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
They're installing the breathalyzer on my email account next week.


More information about the Tutor mailing list