随笔分类 - Python 基础
摘要:os模块提供了walk方法实现目录遍历 遍历某个目录 import os path='/root' for dirpath,dirnames,filenames in os.walk(path): for file in filenames: fullpath=os.path.join(dirpat
阅读全文
摘要:列表去重 1.方法1 借助一个临时列表 ids = [1,2,3,3,4,2,3,4,5,6,1] news_ids = [] for id in ids: if id not in news_ids: news_ids.append(id) print news_ids 2.方法2 使用set方法
阅读全文
摘要:Python 3.5源码编译安装 系统环境:CentOS 6.8-Minimal 安装Python依赖包: [root@Python src]# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel r
阅读全文