12251952

2588 단어
import yaml
import os
yaml.warnings({'YAMLLoadWarning': False})

filepath = "/".join(os.path.dirname(os.path.abspath(__file__)).split("/")) + "/hostname.yaml"


#  yaml  
# a  ,w, 
fw = open(filepath,'w+',encoding='utf-8')
#  
data = {"data":{'is_passed': True, 'new_baseurl': "http://betahyapi.tian-wang.com", 'default_baseurl': "http://betahyapi.tian-wang.com"}}
#  
yaml.dump(data,fw)
#  , 
f = open(filepath,'r',encoding='utf-8')
#  
cont = f.read()
#  
x = yaml.load(cont)
#  
print(x)

좋은 웹페이지 즐겨찾기