I'm trying to get some HTML to work with my python code. I've got this for one of my CSS codes.
#footerBar {
height: 40px;
background: red;
position: fixed;
bottom: 0;
width: 100%;
z-index: -1;
}
However, when I try to access the page, I get the following error.
File "projv2.py", line 151, in welcome
</form>""" %(retrievedFullName, retrievedUserName,)
ValueError: unsupported format character ';' (0x3b) at index 1118
I think it's messing with the %
since I do use that elsewhere in the HTML.
Any help would be greatly appreciated.
If you want to use %
formatting operator, you need to escape your %
characters.
So your css should read:
#footerBar {
height: 40px;
background: red;
position: fixed;
bottom: 0;
width: 100%%;
z-index: -1;
}
instead.
It's preferrable to use the string's .format()
method instead as it is the preferable way. See PEP 3101 for rationale.
So instead of
...""" % (retrievedFullName, retrievedUserName,)
do
...""".format(retrievedFullName, retrievedUserName)
and change the %s
's in your string to {0}
and {1}
. Of course you need to escape your {}
's in this case, too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With