print('test')
print('test1', 'test2', 'test3')
print('test', end
='test_end')
print('test1', 'test2', 'test3', sep
='_')
print(1, 1.23, None, True, [1, 2], sep
='_', end
='*')
print(1, 1.23, None, True, [1, 2], sep
=1, end
='*')
print('test1', 'test2', 'test3', sep
=None, end
=None)
print()
print(end
='test_end')
f
= open('test.txt', 'w')
print('test', file=f
)
f
.close
()
import time
for test
in ["test1", "test2", "test3"]:
print(test
, end
='')
time
.sleep
(2)
for test
in ["test1", "test2", "test3"]:
print(test
, end
='', flush
=True)
time
.sleep
(2)
f
= open('test_file2.txt', 'w')
print('test1', file=f
)
time
.sleep
(10)
f
.close
()
f
= open('test_file3.txt', 'w')
print('test1', file=f
, flush
=True)
time
.sleep
(10)
f
.close
()
代码来自周华健的网课 - 《轻松学习Python 69个内置函数》 https://edu.csdn.net/course/play/31010/459524?spm=1002.2001.3001.4143
转载请注明原文地址: https://lol.8miu.com/read-22327.html