An error when i switched from python v2.6.6 => v3.2.3

Chris Angelico rosuav at gmail.com
Thu Mar 7 10:33:10 EST 2013


On Fri, Mar 8, 2013 at 2:26 AM, Νίκος Γκρ33κ <nikos.gr33k at gmail.com> wrote:
> Τη Πέμπτη, 7 Μαρτίου 2013 5:13:24 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:
>> On Fri, Mar 8, 2013 at 2:01 AM, Νίκος Γκρ33κ <nikos.gr33k at gmail.com> wrote:
>>
>> > os.system( 'python metrites.py > %s' ) % htmltemp
>>
>>
>>
>> Manually step through what this line should do. Follow the exact same
>>
>> rules Python will follow in evaluating this expression.
>>
>>
>>
>> http://docs.python.org/2/reference/expressions.html#operator-precedence
>>
>> http://docs.python.org/3/reference/expressions.html#operator-precedence
>>
>>
>>
>> As you'll see from footnote 8 or 5 (depending on which version of the
>>
>> docs), your percent operator is the same one listed in the table as a
>>
>> division operator.
>>
>>
>>
>> Now. Go through that expression, step by step. Walk through everything
>>
>> the Python interpreter does. Figure out exactly what happens first,
>>
>> second, third. Figure out when your percent operator gets handled.
>>
>> Then you'll know what's wrong with that line of code.
>>
>>
>>
>> You'll also gain a very useful understanding of Python, and more
>>
>> generally of the way most high level languages parse expressions.
>>
>>
>>
>> ChrisA
>
> I'am sorry to say i cant figure this out :(
> please enlight me.

You can figure it out, but it will take some effort. I will not
enlighten you further. The documentation is all there; the answers are
available.

ChrisA



More information about the Python-list mailing list