随笔分类 -  Python 基础

摘要:os模块提供了walk方法实现目录遍历 遍历某个目录 import os path='/root' for dirpath,dirnames,filenames in os.walk(path): for file in filenames: fullpath=os.path.join(dirpat 阅读全文
posted @ 2018-01-03 16:25 SRE在路上 阅读(289) 评论(0) 推荐(0) 编辑
摘要:列表去重 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方法 阅读全文
posted @ 2017-12-19 14:30 SRE在路上 阅读(335) 评论(0) 推荐(0) 编辑
摘要:Python 3.5源码编译安装 系统环境:CentOS 6.8-Minimal 安装Python依赖包: [root@Python src]# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel r 阅读全文
posted @ 2017-03-24 05:50 SRE在路上 阅读(2756) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示