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


Python Files.deleteFolder方法代碼示例

本文整理匯總了Python中Files.deleteFolder方法的典型用法代碼示例。如果您正苦於以下問題:Python Files.deleteFolder方法的具體用法?Python Files.deleteFolder怎麽用?Python Files.deleteFolder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Files的用法示例。


在下文中一共展示了Files.deleteFolder方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: loadGroup

# 需要導入模塊: import Files [as 別名]
# 或者: from Files import deleteFolder [as 別名]
def loadGroup(folder):
  if type(folder) == int:
    folder = "Group "+str(folder)
  try:
    loadedGroup = _folderCache[folder]
    log.group("Group already loaded, returning group:", loadedGroup)
    return loadedGroup
  except KeyError:
    pass #Just continue loading
  try:
    groupNumber = int(re.search("\d+", folder).group())
    log.group("Loading Group:", groupNumber)
  except AttributeError:
    raise RuntimeError("Group Folder '"+folder+"' does not have a group number")
  try:
    with open(Files.getFileName(Files.join(folder, SAVE_FILE_NAME))) as file:
      groupType = Files.read(file)
      log.group("Group Type:",groupType)
      newGroup = globals()[groupType](groupNumber).load(file) #Load arbitrary class
      _folderCache[folder] = newGroup #Save it to a cache so we cannot load twice
      return newGroup
      #except (KeyError, TypeError, AttributeError) as Error: #I actually think I want this to be a halting error.
      #  log.error("Failed to properly load group file:", Error)
  except FileNotFoundError: #The group was improperly initialized/saved
    log.group.error("Group had no load file. Deleting folder")
    Files.deleteFolder(folder)
開發者ID:civilwargeeky,項目名稱:GroupMeServer3,代碼行數:28,代碼來源:Groups.py

示例2: deleteSelf

# 需要導入模塊: import Files [as 別名]
# 或者: from Files import deleteFolder [as 別名]
 def deleteSelf(self):
   log.group(type(self),self.ID,"deleting itself")
   log.group("Deregistering self")
   groupDeregister(self)
   log.group("Deleting Folder")
   Files.deleteFolder(Files.getGroupFolder(self))
開發者ID:civilwargeeky,項目名稱:GroupMeServer3,代碼行數:8,代碼來源:Groups.py


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