Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5049

how can i dynamically keep the quotation marks from this config file?

$
0
0
data:     START_DT: '202001'    END_DT: '202104'    schema: products 

i have the above YAML file.

I want to be able to use it such that i get:

set START_DT='202001';set END_DT='202104';set schema = products 

notice that the dates are in quotes and the products isn't.

with open("data.yml", "r") as ymlfile:    cfg = yaml.load(ymlfile) lines=[]for k,v in cfg['data'].items():     print("SET" +''+  k+'='+ v)     var = ("SET" +''+  k+'='+ v)     lines.append(var)

prints:

SET START_DT=201901SET END_DT=202104 SET SCHEMA=products

but now i have lost the quotation marks in the original config for the dates.. how can i retrieve these back?


Viewing all articles
Browse latest Browse all 5049

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>