Python文件读写方法

context='hello,world,hello1\nworld,hello2\nworld,hello,world3 \n'
with open('hello.txt','w+') as f:
      f.write(context)
      for x in range(0,5,1):
            f.write(str(x)+",")
      f.close
with open('hello.txt','r') as f:      
      datas=f.readlines()
      for data in datas:
            print(data)