Python 使用链式连接和一个空格字符串\“\&引用;
结果Python 使用链式连接和一个空格字符串\“\&引用;,python,pycharm,Python,Pycharm,结果 world = 'World' hello_world =hello +''+ World print(hello_world) # Note: you should print "Hello World" 回溯(最近一次呼叫最后一次): /PycharmProjects/Python简介/Strings/Concatenation/Concatenation.py”,第4行,中 hello_world=hello+“”+world NameError:未定义名称“World
world = 'World'
hello_world =hello +''+ World
print(hello_world) # Note: you should print "Hello World"
回溯(最近一次呼叫最后一次):
/PycharmProjects/Python简介/Strings/Concatenation/Concatenation.py”,第4行,中
hello_world=hello+“”+world
NameError:未定义名称“World”
进程已完成,退出代码为1
Python变量区分大小写,因此变量World
与World
不同
hello\u world=hello+''+world
应该是hello\u world=hello+''+world
world
!=world
变量名区分大小写如何发送屏幕截图?您定义了hello吗?如果没有,您需要在工作之前这样做hello=“hello=”“world=‘world’hello_world=hello+”“+world print(hello_world)#注意:您应该打印“hello world”
Traceback (most recent call last):
/PycharmProjects/Introduction to Python/Strings/Concatenation/concatenation.py", line 4, in <module>
hello_world =hello +''+ World
NameError: name 'World' is not defined
Process finished with exit code 1