當前位置: 首頁>>代碼示例>>Python>>正文


Python Version.get_version方法代碼示例

本文整理匯總了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
開發者ID:PlanetHunt,項目名稱:satgen,代碼行數:39,代碼來源:config_converter.py


注:本文中的version.Version.get_version方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。