This commit is contained in:
parent
3c4a86010d
commit
60e8ecc41a
@ -4,15 +4,15 @@ def object_to_str(obj, keys):
|
|||||||
for key in keys:
|
for key in keys:
|
||||||
value = eval("obj." + key)
|
value = eval("obj." + key)
|
||||||
key = key.replace("()", "")
|
key = key.replace("()", "")
|
||||||
if type(value) == str:
|
if isinstance(value, str):
|
||||||
s += f"{key} = {value}\n"
|
s += f"{key} = {value}\n"
|
||||||
elif type(value) == list:
|
elif isinstance(value, list):
|
||||||
for idx, vv in enumerate(value):
|
for idx, vv in enumerate(value):
|
||||||
if not vv:
|
if not vv:
|
||||||
s += f"{key}[{idx}] = \n"
|
s += f"{key}[{idx}] = \n"
|
||||||
continue
|
continue
|
||||||
s += f"{key}[{idx}] = {vv}\n"
|
s += f"{key}[{idx}] = {vv}\n"
|
||||||
elif type(value) == dict:
|
elif isinstance(value, dict):
|
||||||
for vv_key in value.keys():
|
for vv_key in value.keys():
|
||||||
vv_value = value[vv_key]
|
vv_value = value[vv_key]
|
||||||
if not vv_value:
|
if not vv_value:
|
||||||
|
Loading…
Reference in New Issue
Block a user