0

I am trying to append a list present in a text file which is of json formate. But I'm unable to append it. can you help me out...?

p=open(r"phbook.txt","at")
l=p.readline().split(",")

output:

Traceback (most recent call last):
  File "E:/pyt train/my1/phyton-training/file handelling/phone book save.py", line 2, in <module>
    l=p.readline().split(",")
io.UnsupportedOperation: not readable
Selcuk
  • 57,004
  • 12
  • 102
  • 110
  • You are opening the file in `at` mode, which is for appending only. You can't read from that file. – Selcuk Jun 11 '19 at 02:01
  • 1
    Possible duplicate of [Python error message io.UnsupportedOperation: not readable](https://stackoverflow.com/questions/44901806/python-error-message-io-unsupportedoperation-not-readable) – Selcuk Jun 11 '19 at 02:02
  • Possible duplicate of [How to read a text file into a list or an array with Python](https://stackoverflow.com/questions/14676265/how-to-read-a-text-file-into-a-list-or-an-array-with-python) – biozid bostami Jun 11 '19 at 02:05

0 Answers0