def definition():
global storage_account_connection_string
storage_account_connection_string="test"
def load_config():
config = ConfigParser.ConfigParser()
config.readfp(open(r'config.txt'))
temp = config.get('API_Metrics','SCC')
temp1 = temp.split("#")
for conf in temp1:
confTemp=conf.split(":")
print "#########################################"
print confTemp[0]
print confTemp[1]
print confTemp[2]
storage_account_connection_string=confTemp[2]
print storage_account_connection_string
get_details()
def get_details():
print storage_account_connection_string
print "Blob",blob_name_filter
if __name__ == '__main_`enter code here`_':
definition()
load_config()`enter code here`
我的问题是,为什么连接字符串总是在get\u details()中打印“test”,尽管它在load\u config()中被分配了一些值,但我遗漏了什么吗
检查此示例:
在您的例子中,您需要将global添加到此函数中
我无法运行您的代码,但如果我明白了这一点,这将有助于调试:
或者这个:
相关问题 更多 >
编程相关推荐