```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())
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐