• python unrar 解压缩


    class UNRARModel:
        def __init__(self, filepath):
            self.rar = rarfile.RarFile(filepath)
            self.infolist = self.rar.infolist()
    
        def extral_list(self, selected_dir):
            selected_infolist = []
            for d in selected_dir:
                for info in self.infolist:
                    filename = info.filename.replace("\", "/")  # in win
                    if filename.find(d) != -1 and info.file_size != 0L:
                        selected_infolist.append(info)
    
            return selected_infolist
    
        def decompression_list(self, selected_infolist, to_dir):
            """
            extract the Specified directory
            :param selected_infolist: Specified directory
            :param to_dir: destination
            :return:
            """
            self.rar.extractall(path=to_dir, members=selected_infolist)
    

      

    def rar_decompression(from_path, to_path):
        from_path = from_path.replace("\", "/")  # in win
        rar = rarfile.RarFile(from_path)
        rar.extractall(to_path)
    
        standout_print("Info: decompression %s to %s finish." % (from_path, to_path))
    
    
    def remove_file(file_path):
        """
        remove file
        :param file_path:
        :return:
        """
        os.remove(file_path)
        standout_print("Info: remove files %s finish." % file_path)
    

      

  • 相关阅读:
    Jboss下jaxws的开发
    Jboss as 服务器基本设置
    classloader常见问题总结
    Servlet容器 Jetty
    Jetty 的工作原理以及与 Tomcat 的比较
    resin设置jvm参数
    Solr4.0使用
    Solr 4.0部署
    Solr 搜索功能使用
    HttpSolrServer 实例管理参考,来自org.eclipse.smila.solr
  • 原文地址:https://www.cnblogs.com/dasheng-maritime/p/7593809.html
Copyright © 2020-2023  润新知