python 输出与输入

输出

print("helloworld")
print('你好啊')

格式化输出

a = "hello"
b = 10
print(a + ' world ' + str(b))
print("%s world %d" %(a, b))
print("{A} python {B}".format(A=a, B=b))
#不知道打印类型,可使用 %r

换行输出

\n 后的内容会在另一行显示;

print("12345\n67890")

在这里插入图片描述

输入

input()函数

a = input("请输入您的年龄:")

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_41725711/article/details/83625205