write task5

This commit is contained in:
2024-09-07 15:52:12 +08:00
parent cd429d4abf
commit 4c409ace18
2 changed files with 54 additions and 0 deletions

19
A/4/A4_to_csv.py Normal file
View File

@@ -0,0 +1,19 @@
import json
with open("A4_res.json", "r") as file:
content=json.load(file)
fout1=open("tmp1.dat","w")
for node_point in range(224):
for time_point in range(201):
v=content[time_point][node_point]["v"]
print(v,'\t',file=fout1,sep="",end="")
print('\n',file=fout1,end="",sep="")
fout2=open("tmp2.dat","w")
for node_point in range(224):
for time_point in range(201):
x=content[time_point][node_point]["node"][0]
print(x,'\t',file=fout2,sep="",end="")
print('\n',file=fout2,end="",sep="")
for time_point in range(201):
y=content[time_point][node_point]["node"][1]
print(y,'\t',file=fout2,sep="",end="")
print('\n',file=fout2,end="",sep="")