ValueError: unsupported character '{' (0x7b) in dictionary definition

I am writing code for web development using the Google Python Appengine. In my code, I have to concatenate strings using% and a dictionary. Here is the code I wrote.

def print_form(self, unameError='', passwdError='', verpasswdError='', emailError='', unameValue='', emailValue='' ): self.response.out.write( form3 % { "unameError" : unameError, "passwdError" : passwdError, "verpasswdError": verpasswdError, "emailError" : emailError, "unameValue" : unameValue, "emailValue" : emailValue } ) 

For this code, I get this error from the server:

web-app-local-directory-path / main.py ", line 139, in print_form" emailValue ": emailValue ValueError: unsupported format character '{' (0x7b) at index 218

I can’t understand what is wrong with this code. I have defined a valid dictionary and it seems I have no problem with it.

Someone please help me with this.

Relationship Wid, Abhishek

+6
source share
1 answer

It looks like you might have the sequence "% {" in the value of form3 .

+8
source

Source: https://habr.com/ru/post/916016/


All Articles