Python编程时能在显示器上输出信息的函数是?

Python024

Python编程时能在显示器上输出信息的函数是?,第1张

pint()函数,是python中屏幕输出用的。

如:

a = "test"

print(a)

print("test")

print("this", "is", "a", "test", "!")

print("this " + "is " + "a " + "test " + "!")

如有帮助,请采纳!!!

读取键盘输入

内置函数input([prompt]),用于从标准输入读取一个行,并返回一个字符串(去掉结尾的换行符):

s = input("Enter your input:")

登录后复制

注:在Python 3.x版本中取消了 raw_input() 函数。

打印到屏幕

最简单的输出方法是用print语句,你可以给它传递零个或多个用逗号隔开的表达式:

print([object, ...][, sep=' '][, end='endline_character_here'][, file=redirect_to_here])

登录后复制方括号内是可选的,sep表示分割符,end表示结束符,file表示重定向文件。如果要给sep、end、file指定值必须使用关键字参数。