mirror of
https://github.com/Sosokker/Calculator-for-Matrix-and-Algebra.git
synced 2025-12-18 12:44:05 +01:00
Initial commit
This commit is contained in:
parent
2d71d41d05
commit
d9a0e456d2
20
file_read_write.py
Normal file
20
file_read_write.py
Normal file
@ -0,0 +1,20 @@
|
||||
import json
|
||||
import os
|
||||
|
||||
def read_write_command(com):
|
||||
filename = "history.json"
|
||||
file_data = {}
|
||||
|
||||
try:
|
||||
with open(filename, "r") as file:
|
||||
file_data = json.load(file)
|
||||
except :
|
||||
pass
|
||||
|
||||
file_data = {2:com}
|
||||
|
||||
with open(filename, "w") as file:
|
||||
json.dump(file_data, file, indent = 4)
|
||||
|
||||
def delete():
|
||||
os.remove("history.json")
|
||||
Loading…
Reference in New Issue
Block a user