print()函数是也属于一种函数,用系统库语言可以写出来它的底层简单逻辑,但这只是阉割版的功能,用于理解print函数。
import sys
def my_print(*var,sep=" ",end="\n"):
for x in var: #遍历可变数组
sys.stdout.write(str(x)) #将输入强制转换为字符串并打印
sys.stdout.write(sep) #打印分隔标识符
sys.stdout.write(end) #遍历结束之后打印结尾标识符