简体   繁体   English

使用字符串格式时不支持的格式字符

[英]Unsupported format character when using string formatting

The problem is that I'm getting this error message: 问题是我收到以下错误消息:

unsupported format character ',' (0x2c) at index 27

While using the string formatting on this: 在此使用字符串格式时:

v = 60 / 100.0
messenger.append("Base Skill Level +%,0f" % chop(20 + 15 * v))

messenger.append works just like the print() if someone would be curious. 如果有人感到好奇, messenger.append工作原理与print()一样。

The question is, how to solve this? 问题是,如何解决这个问题? I cant see the problem here as far as , is required here: %,0f . 我不能在这里就看到这个问题,这里需要: %,0f

I'm using Python version 2.2 我正在使用Python 2.2版

I think you meant %.0f instead of ,0f . 我认为您的意思是%.0f而不是,0f As far as I know, there is no such thing as ,0f 据我所知,没有这样的东西,0f

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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