python - 我们如何让程序输出一个int?
问题描述
我正在尝试制作一个有一个while循环的代码,里面是显示已经执行了多少句子的执行。为了向您展示我的意思,这是我的代码:
while riddle < 11:
print('this is the '+riddle+ 'th execution')
riddle = riddle+1
我的问题是,如果我运行它,我有这个错误:
Traceback (most recent call last):
File "/home/thejackl/hello world/hello_world.py", line 62, in <module>
print('this is the '+riddle+ 'th execution')
TypeError: must be str, not int
更多信息:
- 我正在使用 python 2
- 我的编译器是pycharm
解决方案
推荐阅读
- python - 如何通过从熊猫中的一行中获取名称来指定列
- r - 共享 R 降价输出
- javascript - 不要得到“P”值的输出
- snowflake-cloud-data-platform - 雪花中流的奇怪行为
- flutter - 如何在 Flutter 中从快照中求和不同的字符串
- google-cloud-platform - 如何在 GCP 中使用负载均衡器指向后端端口
- c# - C# RSA 导入公钥
- java - 将字符串列表转换为单个对象
- react-native - 如何解决“react-native-crypto-js”sha256 未定义错误
- python - 无法从节点连接读取描述符:连接到系统的设备无法使用 ChromeDriver Chrome 通过 Selenium 运行错误