Skip to content

Commit 1fb2d8e

Browse files
committed
Actually give read permissions
1 parent 25132ee commit 1fb2d8e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

vartest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33

44
def main():
5-
with open("my_file.txt", "rw") as f:
5+
with open("my_file.txt", "r+") as f:
66
pet_list = json.load(f)
7+
f.seek(0)
78
pet_list.append({"name": "Spike", "id": 124})
89
json.dump(pet_list, f)
10+
f.truncate()
911

1012

1113
if __name__ == "__main__":

0 commit comments

Comments
 (0)