目录
qgdm示例
from tqdm import tqdm
import time
for i in tqdm(range(10000)):
time.sleep(0.01)
sys.stdout和print的区别
原创朔方_ 最后发布于2018-06-25 17:01:46 阅读数 11053 收藏
展开
一 sys.stdout的形式就是print的一种默认输出格式,等于print "%VALUE%"
print函数是对sys.stdout的高级封装,看下print函数的解释
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.
print是默认调用了sys.stdout.write()方法将输出打印到控制台
print 也可通过file参数将输出打印到其他文件中
f = open('test.txt','a')
print('this is a test',