本文整理匯總了Python中version.Version.get_version方法的典型用法代碼示例。如果您正苦於以下問題:Python Version.get_version方法的具體用法?Python Version.get_version怎麽用?Python Version.get_version使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類version.Version
的用法示例。
在下文中一共展示了Version.get_version方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: convert_file
# 需要導入模塊: from version import Version [as 別名]
# 或者: from version.Version import get_version [as 別名]
def convert_file(self, file_address, written_file_name=False):
"""
Get the txt file and convert it to the
shelx config file, returns the generated
config file name as string. suffix will be added
if a file with a same name exist.
"""
version = Version()
version_tag = version.get_version()
f = self.read_file(file_address)
if(written_file_name):
written_file = open(written_file_name, 'w')
else:
written_file = open(
self.get_file_container(f)["name"] + ".cfg", 'w')
file_name = written_file.name
written_file.write(
"#Config file generated by SatGen V. " + version_tag)
for line in list(f):
if(not re.search("Date", line)):
line = re.sub(":", "=", line)
if(re.search("Date", line)):
line = re.sub("(?<=[^0-9]):", "=", line.strip())
line = re.sub("\[ ", "[", line)
line = re.sub(" \]", "]", line)
line = line.strip()
line = line + "\n"
try:
written_file.write(line)
self.log.debug(written_file.name + " is written to the disk!")
except IOError as e:
self.log.error(
"I/O error({0}): {1}".format(e.errno, e.strerror))
raise
written_file.close()
f.close
return file_name