我想减少字符串变量lent
的长度。我得到这个错误:
15
Traceback (most recent call last):
File "script.py", line 25, in <module>
script()
File "script.py", line 11, in script
calc = print(str(lent) - str(1))
TypeError: unsupported operand type(s) for -: 'str' and 'str'
这是我的密码:
for country in countrys:
key = pg.typewrite('in ' + str(country))
lent = print(len(str(key) + str(country)))
calc = print(str(lent) - str(1))
变量
lent
是一个integer
。你只需要减少1
:由于您的代码已完全损坏(您通常不为任何内容分配打印返回值),并且您尝试添加/删除stings和ints,目前还不清楚打字机的功能以及您在country和lent中期望的数据类型,我只能假设您想要:
相关问题 更多 >
编程相关推荐