resort to a Python loop to read the file, assign a value to the read string, and then further generate json file.
was supposed to be written in shell, using things like while read line do. Done < table.list.
but json file doesn"t know how to write it, so I can only try to write a loop in Python.
the current problem is that TABLE in the TABLE.csv file is a variable, a table name taken from table.list, and I don"t know how to use the variable in Python. Ask for help from the god!
import base64
import os
with open ("table.list","r") as f4:
for line in f4:
TABLE = line
f = open ("TABLE.csv", "r")
content = f.read ()
content1 = content.encode (encoding="utf-8")
content2 = base64.b64encode (content1)
f.close ()
if os.path.getsize ("TABLE.step1"):
print (" file exists and not empty")
F1 = open ("TABLE.step2","r")
V_Sha=f1.read ()
f1.close ()
with open (" TABLE.csv.json", "w") as J1:
j1.write ("{"message": "ci skipdata into file", "content": ""+ content2 +"", "sha": ""+ V_Sha +"" "branch": "xxx"}")
else:
with open ("TABLE.csv.json", "w") as J1:
j1.write (" {"message": "ci skipdata into file", "content": ""+ content2 +"", "branch": "xxx"}")
f4.close ()