Python 输出变量
输出变量
Python 的 print
语句通常用于输出变量。
例子 1
x = "Python is awesome" print(x)
要组合文本和变量,Python 使用 +
字符:
例子 2
x = "awesome" print("Python is " + x)
您还可以使用 ,
逗号字符, 来打印一个以上的字符串/变量:
例子 3
x = "awesome" print("Python is", x)
Python 的 print
语句通常用于输出变量。
x = "Python is awesome" print(x)
要组合文本和变量,Python 使用 +
字符:
x = "awesome" print("Python is " + x)
您还可以使用 ,
逗号字符, 来打印一个以上的字符串/变量:
x = "awesome" print("Python is", x)