i wrote a small function to do this job
x = 'INV-%05d'
m = x %(100+1)
i should have m = INV-0101
but i receive this error
ValueError: unsupported format character 'O' (0x4f) at index 2
this works without any problem, but i want to use an external variable
m = INV-%05d %(100+1)
-> m = INV-0101
because the original value should come from a saved variable
如错误消息中所报告的, 0x4f
是大写字母O的ASCII值。看来您犯了印刷错误,并在想要零时放入O。
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.