本文整理汇总了Python中core.inputfile.Section.get_text方法的典型用法代码示例。如果您正苦于以下问题:Python Section.get_text方法的具体用法?Python Section.get_text怎么用?Python Section.get_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.inputfile.Section
的用法示例。
在下文中一共展示了Section.get_text方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_text
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import get_text [as 别名]
def get_text(self):
"""format contents of this item for writing to file"""
# Use default get_text, but need to skip LID if it is NONE
lines = []
for line in Section.get_text(self).splitlines():
if line.split() != ["LID", "NONE"]:
lines.append(line)
return '\n'.join(lines)
示例2: get_text
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import get_text [as 别名]
def get_text(self):
if self.global_efficiency == "75" \
and self.global_price == "0.0" \
and self.global_pattern == '' \
and self.demand_charge == "0.0" \
and len(self.pumps) == 0:
return '' # This section has nothing different from defaults, return blank
else:
txt = []
txt.append(Section.get_text(self)) # Get text for the global variables using metadata
for pump_energy in self.pumps: # Add text for each pump energy
txt.append(pump_energy.get_text())
return '\n'.join(txt)
示例3: get_text
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import get_text [as 别名]
def get_text(self):
"""Contents of this item formatted for writing to file"""
# First, add the values in this section stored directly in this class
text_list = [Section.get_text(self)]
if self.dates is not None: # Add the values stored in Dates class
text_list.append(General.section_comments[0])
text_list.append(self.dates.get_text().replace(self.SECTION_NAME + '\n', ''))
if self.time_steps is not None: # Add the values stored in TimeSteps class
text_list.append(General.section_comments[1])
text_list.append(self.time_steps.get_text().replace(self.SECTION_NAME + '\n', ''))
if self.dynamic_wave is not None: # Add the values stored in DynamicWave class
text_list.append(General.section_comments[2])
text_list.append(self.dynamic_wave.get_text().replace(self.SECTION_NAME + '\n', ''))
return '\n'.join(text_list)