Skip to content Skip to sidebar Skip to footer

Syntaxerror: Keyword Can't Be An Expression

I have hd.meta(http-equiv='Content-Type', content='text/html;charset=UTF-8') And I am getting: SyntaxError: keyword can't be an expression Why so ?

Solution 1:

As @Misandrist already pointed out, http-equiv is interpreted as a subtraction like this: http - equiv.

If you still need to pass the data to this function, you can do the following thing:

dct = {
       'http-equiv': 'Content-Type',
       'content': 'text/html;charset=UTF-8'
}
hd.meta(**dct)

Put the keyword arguments into a dictionary and pass its expansion (**dct).

Post a Comment for "Syntaxerror: Keyword Can't Be An Expression"