print(...)
print(value, ..., sep=‘ ‘, end=‘\n‘, file=sys.stdout, flush=False)
Prints the values to a stream, or to sys.stdout by default.
Optional keyword arguments:
file:  a file-like object (stream); defaults to the current sys.stdout.
sep:   string inserted between values, default a space.
end:   string appended after the last value, default a newline.
flush: whether to forcibly flush the stream.
在python中,print默认向屏幕输出指定的文字,例如:
>>>print(‘hello,world‘)hello world
print的完整格式为print(objects,sep,end,file,flush),其中后面4个为可选参数
>>>print("a","b","c",sep="**")a**b**cprint输出语句的结尾加上指定字符串,默认是换行(\n),例如:>>>print("a",end="$")a$>>>f = open(‘abc.txt‘,‘w‘)>>>print(‘a‘,file=f)>>>f = open(‘abc.txt‘,‘w‘)>>>print(‘a‘,file=f)f.close()之后才将内容写进文件。>>>print(‘a‘,file=f,flush=True)原文:http://www.cnblogs.com/jiduxia/p/7492037.html