Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
You can use the json module
Write:
import json
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
with open('test.json', 'w') as f:
f.write(json.dumps(a))
import json
with open('test.json', 'r') as f:
b = json.loads(str(f.read()))
print(b)
Another pickle option.
import pickle
arr = ["one.jpg", "two.jpg"]
with open('arr.pickle', 'wb') as f:
pickle.dump(arr, f, 2)
import pickle
with open('arr.pickle', 'rb') as f:
arr = pickle.load(f)
print(arr)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question