code: def rename(self, new_dirname=None, new_fname=None, new_ext=None):
          
          if not new_dirname:
              new_dirname = self.dirname
          else:
              new_dirname = os.path.abspath(new_dirname)
          if not new_fname:
              new_fname = self.fname
          if new_ext: # 检查新文件名的扩展名格式是否
              if not new_ext.startswith("."):
                  raise ValueError("File extension must in format .ext, "
                                   "for example: .jpg, .mp3")
          else:
              new_ext = self.ext
          new_basename = new_fname + new_ext
          new_abspath = os.path.join(new_dirname, new_basename)
  
          os.rename(self.abspath, new_abspath)
          # 如果成功重命名, 则更新文件信息
          self.abspath = new_abspath
          self.dirname = new_dirname
          self.basename = new_basename
          self.fname = new_fname
          self.ext = new_ext
docs: Rename the dirname, fname, extension or their combinations.
          
          **中文文档**
          
          对文件的父目录名, 纯文件名, 扩展名, 或它们的组合进行修改。