25 lines
601 B
Python
25 lines
601 B
Python
|
import yaml
|
||
|
# ...
|
||
|
import argparse
|
||
|
parser = argparse.ArgumentParser()
|
||
|
parser.add_argument('rargs', nargs='*', default=[])
|
||
|
a = parser.parse_args()
|
||
|
with open(a.rargs[0], 'r') as file:
|
||
|
# The FullLoader parameter handles the conversion from YAML
|
||
|
# scalar values to Python the dictionary format
|
||
|
xx = yaml.load(file)
|
||
|
print(yaml.dump(xx))
|
||
|
|
||
|
for x in xx:
|
||
|
print(x)
|
||
|
print(xx[x])
|
||
|
c = xx[x]
|
||
|
print(c)
|
||
|
if isinstance(c, str):
|
||
|
pass
|
||
|
else:
|
||
|
try:
|
||
|
print(c['delay'])
|
||
|
except KeyError:
|
||
|
pass
|