I dont know what goes wrong in this piece of code?!!
I keep getting the following error.

File "<stdin>", line 11
t1.append(list[temp])
^
SyntaxError: invalid syntax

tl = []
for inlist in token_list:
    temp=[]
    for token in inlist:
        temp.append((zlib.adler32(token,65521))
    tl.append(temp)

Hey,
I'm new to programming so this may be wrong or not what you want.

tl = []
for inlist in token_list:
    temp=[]
    for token in inlist:
            temp.append(zlib.adler32(token,65521)) #You had an extra (
            tl.append(temp)

And from what it says now you need to define token_list

Is that all of your code?

Sorry if this is wrong :)

Comments
you're right, there is an extra (

t-one or t-el? Maybe there would exist clearer variable names? By the way have you learned about list comprehensions?

As Shlaa said you have an extra "(" on line 5.
The interpreter thinks that the statement continues in the next line, and finds no closing ")" token.

File "<stdin>", line 11
t1.append(list[temp])

"list" is a function so it should be
t1.append(list(temp))
In the future, if there is an error for a compound statement, break the statement into it's individual parts to see which part is causing the error.

t-one or t-el? Maybe there would exist clearer variable names? By the way have you learned about list comprehensions?

t-el!!!!!

@everyone: yup. that "(" was making the problem.. i was working continuously for 20+ hours and my mind was all f***ed up!!! I had some nice sleep.. and then i could figure this out easily...
Thanks everyone for the help!

Edited 6 Years Ago by knan: n/a

t-el!!!!!

@everyone: yup. that "(" was making the problem.. i was working continuously for 20+ hours and my mind was all f***ed up!!! I had some nice sleep.. and then i could figure this out easily...
Thanks everyone for the help!

Mismatched parentheses have a high probability when a SyntaxError is raised.

This article has been dead for over six months. Start a new discussion instead.