简体   繁体   中英

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

I'm writing some code for web development using Google Python Appengine. In my code I have to concatenate strings using % and dictionary Here's the code I've written.

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'm receiving this error from 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 seem to figure out what is wrong in this code. I've defined a valid dictionary and there seem to be no problem with it according to me.

Somebody please help me on this.

Regards Vaid, Abhishek

听起来你可能在form3的值中有序列“%{”。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM