Skip to content

Instantly share code, notes, and snippets.

@lhsfcboy
Created July 11, 2017 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lhsfcboy/16d167290f50eb783919bfdae901b582 to your computer and use it in GitHub Desktop.
Save lhsfcboy/16d167290f50eb783919bfdae901b582 to your computer and use it in GitHub Desktop.
read new license conf file and update to current using conf ini file
# coding=utf8
import configparser
import os
import requests
UL_DASHBOARD_LICENSE_PATH = r'C:\Users\mluo\Downloads\UL DASHBOARD_test_licenseTXT.txt'
UL_DASHBOARD_LICENSE_PATH_USING = r'C:\Ullink\platform201610Full\-CleanUp-\ULDASHBOARD\conf\ul-dashboard-server.ini'
cf = configparser.ConfigParser()
cf.read(UL_DASHBOARD_LICENSE_PATH_USING)
cf.remove_section("licence")
cf.read(UL_DASHBOARD_LICENSE_PATH)
secs = cf.sections()
print ('sections:', secs, type(secs))
#cf.add_section("test")
#cf.set("test", "count", "1")
#cf.add_section("test1")
#cf.set("test1", "name", "aaa")
with open(UL_DASHBOARD_LICENSE_PATH_USING,"w+") as f:
cf.write(f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment