简体   繁体   中英

Unsupported format character “;”. Can't figure this out

I've been stumped on what is probably a very stupid mistake for a while now. Searching google has not helped me.

I am learning python and trying to create a simple signup page. When I try to use string substitution I seems to be failing with this error: Unsupported format character ";"

This is the python code.

def write_form(self, username=""):
    self.response.out.write(signupform %{'usr': username})

Here is the html:

<form method="post">
    <label>Username:</label> 
    <input type="text" name="username" value="%(usr)s"><br>

Your html probably contains some other % character.

My wild guess is something like style="width:100%; heigh:20px;" somewhere.

You should double all raw % in the file to escape them.

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