#JSON 字符串多参数化
from datetime import datetime as dt
a_id_temp=123456
b_number_temp=10
c_uid_temp="abcd123456"
datastr='{\
"a_id": %s,\
"b_number": %s,\
"c_uid": "%s"\
}'%(a_id_temp,b_number_temp,c_uid_temp)
#或者下面的方式
datastr = json.dumps({'a_id': a_id_temp, 'b_number': b_number_temp, 'c_uid': c_uid_temp})
print(f"datastr: {datastr}")
data = json.loads(datastr)
print(f"data: {data}")
counseling_id = int(data['a_id'])
top_number = int(data['b_number'])
if('c_uid' in data):
c_uid = str(data['c_uid'])
else:
c_uid = None
if c_uid is not None :
print(f"c_uid is not None: {c_uid}")
else:
print(f"c_uid is None: {c_uid}")
message="abc"
dtNow = dt.now().strftime('%Y/%m/%d %H:%M:%S')
print('{0} {1}'.format(dtNow,message))