Python一边读文件 一边写文件
```pythonfilepath = ""def read_and_write():if os.path.exists(filepath):os.remove(filepath)for i in range(300):time.sleep(1)with open(filepath, "a") as f1:f1.write(str(i))with open(filepath, "r").
·
```python
filepath = ""
def read_and_write():
if os.path.exists(filepath):
os.remove(filepath)
for i in range(300):
time.sleep(1)
with open(filepath, "a") as f1:
f1.write(str(i))
with open(filepath, "r") as f2:
print(f2.readline())
更多推荐
已为社区贡献2条内容
所有评论(0)