本文整理汇总了Python中FileDict.FileDict.writeToFile方法的典型用法代码示例。如果您正苦于以下问题:Python FileDict.writeToFile方法的具体用法?Python FileDict.writeToFile怎么用?Python FileDict.writeToFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileDict.FileDict
的用法示例。
在下文中一共展示了FileDict.writeToFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeRun
# 需要导入模块: from FileDict import FileDict [as 别名]
# 或者: from FileDict.FileDict import writeToFile [as 别名]
def makeRun(self, baseConfig, runData):
"""Make a new run of config files from the base config and runData.
runData is a list of tuples which contain a label and a dict.
Labels are used to name generated configs and their specified output
files. The dicts are key-value pairs for data to modify in the
base config. Return a list of the names of config files generated.
"""
configNames = []
baseConfigFullPath = os.path.join(self.path, baseConfig)
for label, labelData in runData:
newConfig = FileDict(baseConfigFullPath)
newConfigFullPath = os.path.join(self.path, label + "_config")
labelData.update({"outputLogName" : label + "_out.fd",
"errorLogName" : label + "_error",
"debugLogName" : label + "_debug"})
for key, value in labelData.items():
newConfig.setGlobal(str(key), str(value))
configNames.append(newConfigFullPath)
newConfig.writeToFile(newConfigFullPath)
return configNames