当我修改字符串时Erorr [英] Erorr while I am modifying the strings

查看:61
本文介绍了当我修改字符串时Erorr的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试修改字符串时出错并且错误是



Traceback(最近一次调用最后一次):



文件D:/Python/Projects/firstcode.py,第36行,< module>

我在国际伊斯兰学校学习,

print(Learning+ learning_subject.isupper())

我喜欢编程,

TypeError:只能将str(不是bool)连接到str < br $> b $ b

我尝试了什么:



learning_subject =Python



print(学习+ learning_subject.isupper())

Getting an error when i am trying to modify the string and the error is

Traceback (most recent call last):

File "D:/Python/Projects/firstcode.py", line 36, in <module>
I study in International Islamic School,
print("Learning" + learning_subject.isupper())
I love Programming,
TypeError: can only concatenate str (not "bool") to str

What I have tried:

learning_subject = "Python"

print("Learning" + learning_subject.isupper())

推荐答案

这是完全一样的问题你上一次:为什么我收到错误代码Python? [ ^ ]

哎呀,即使错误信息是相同的,也可以这样做!



所以,可以预见的是,解决方案也是如此:

This is exactly the same problem you had last time: Why I am getting an error code in Python?[^]
Heck, even the error message is the same, barting the type!

So, predictably enough, the solution is the same as well:
learning_subject = "Python"

print("Learning " + str(learning_subject.isupper()))


节省一些时间,转到 Python教程 - Python 3.7.1文档 [ ^ ]。
Save yourself some time, go to The Python Tutorial — Python 3.7.1 documentation[^] .


这篇关于当我修改字符串时Erorr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆