python - 如何在海龟模块python的写入命令中使用整数
问题描述
我想在写命令中使用整数。
import turtle
t=turtle.Turtle()
a=0
b=0
t.write(a,':',b)
当我运行此代码时,它会显示以下错误:
Traceback (most recent call last):
File "C:\Users\Drukker\AppData\Local\Programs\Python\Python39\Among_us.py", line 5, in <module>
t.write(a,':',b)
File "C:\Users\Drukker\AppData\Local\Programs\Python\Python39\lib\turtle.py", line 3432, in write
end = self._write(str(arg), align.lower(), font)
AttributeError: 'int' object has no attribute 'lower'
有谁知道解决这个问题?谢谢
解决方案
您应该使用一个字符串作为参数。尝试;
t.write(str(a)+':'+str(b))
推荐阅读
- android - Firebase 测试实验室对 Appium 的支持
- php - 谷歌 api 地理编码只得到一些值
- java - EditText 内容在 Listview 中每 4 个列表项重复一次
- jquery - Jquery .on(click) 寻找触发器
- php - PHP,MySQL - 如何显示值高于的所有行的所有结果
- javascript - 使用CSS单击按钮时无法更改图像
- json - 如何用 JSON 表示 PostgreSQL 中的稀疏 RDBS 列
- postgresql - psql/heroku 连接被拒绝,不接受端口 5432 上的 TCP/IP 连接
- python - 如何使子进程按键
- java - Java拼图模块应用程序:抛出java.lang.module.ResolutionException,虚假声称拆分包