本文整理汇总了Python中string.Template.ssubstitute方法的典型用法代码示例。如果您正苦于以下问题:Python Template.ssubstitute方法的具体用法?Python Template.ssubstitute怎么用?Python Template.ssubstitute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类string.Template
的用法示例。
在下文中一共展示了Template.ssubstitute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createPO
# 需要导入模块: from string import Template [as 别名]
# 或者: from string.Template import ssubstitute [as 别名]
def createPO(self):
propertys = ""
for i in self.tb.columns:
typ = "String"
if i.data_Type == "int":
typ = "int"
if i.data_Type == "timestamp":
typ = "Date"
if i.column_Comment != '' and i.column_Comment != None:
print "\t/**"
print "\t*" + i.column_Comment
print "\t*/"
print "\tprivate " + typ + " " + i.column_Name.lower() + ";"
t = Template("\tpublic ${type} get ${nameU}() {\n"
"\t\treturn this.${name};\n"\
"\t}\n\n"\
"\tpublic void set ${nameU}(${type} ${name}) {\n"\
"\t\tthis.${name} = ${name};\n"\
"\t}\n\n")
#propertys += "\tpublic " + typ + " get" + i.column_Name.lower().capitalize() + "() {\n"
#propertys += "\t\treturn this." + i.column_Name.lower() + ";\n"
#propertys += "\t}\n\n"
#propertys += "\tpublic void set" + i.column_Name.lower().capitalize() + "(" + typ + " " + i.column_Name.lower() + " ) {\n"
#propertys += "\t\tthis." + i.column_Name.lower() + " = " + i.column_Name.lower() + ";\n"
#propertys += "\t}\n\n"
propertys = t.ssubstitute(type=typ, nameU=i.column_Name.lower().capitalize(), name=i.column_Name.lower())
print ""
if i.data_Type != "timestamp":
continue
print "\tprivate String " + i.column_Name.lower() + "Str;"
propertys += "\tpublic String get" + i.column_Name.lower().capitalize() + "Str() {\n"
propertys += "\t\treturn TypeCommon.ConvertToString(this." + i.column_Name.lower() + ");\n"
propertys += "\t}\n\n"
print propertys