![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
文章平均质量分 63
younglibin
这个作者很懒,什么都没留下…
展开
-
Python中pass语句的作用是什么
ss:passpass在软件设计阶段也经常用来作为TODO,提醒实现相应的实现,比如:def initlog(*args):pass #please implement this原创 2013-05-27 13:40:01 · 1107 阅读 · 0 评论 -
python 添加 threadpool
p”尚未安装。 您可以使用以下命令安装: sudo apt-get install python-pip 再使用pip 安装 threadpool sudo pip install threadpool 也可以直接下载 threadpool 包,下载之后可以看到setup.py 文件 ,执行安装,但是setup.py 有可能依赖其他的软件包,所有还是使用pip方便!2013-05-27 15:01:40 · 683 阅读 · 0 评论 -
使用Python的threadpool模块例子
t_result(request, result): 11 print "the result is %s %r"%(request.requestID, result) 12 13 data = [ random.randint(1, 10) for i in range(20) ] 14 15 pool = threadpool.ThreadPool(5) 16 requests = threadpool.makeRequests(hello, d原创 2013-05-27 15:12:03 · 163 阅读 · 0 评论 -
python对文件进行读写操作
w以写方式打开文件,可向文件写入信息。如文件存在,则清空该文件,再写入新内容a以追加模式打开文件(即一打开文件,文件指针自动移到文件末尾),如果文件不存在则创建r+以读写方式打开文件,可对文件进行读和写操作。w+消除文件内容,然后以读写方式打开文件。a+以读写方式打开文件,并把文件指针移到文件尾。b以二进制模式打开文件,而不是以文本模式。该模式只对Windows或D原创 2013-05-29 14:26:37 · 451 阅读 · 0 评论 -
Python中的type(anyObj) 函数 types 模块
y_list)Out[4]: list 如果要判断某种数据类型 可以使用types 模块 In [5]: type("123") is strOut[5]: True In [6]: type(123) is intOut[6]: True In [7]: import types In [8]: type(123) is types.IntTypeOut[8]: True 以下是types提供的方法:types.Bo原创 2013-05-31 10:42:22 · 274 阅读 · 0 评论 -
Python正则表达式十种相关的匹配方法
原创 2013-05-31 10:59:59 · 153 阅读 · 0 评论 -
获取python执行shell命令的结果
原创 2013-06-04 17:17:45 · 501 阅读 · 0 评论 -
python IDE
原创 2013-07-10 17:55:07 · 52 阅读 · 0 评论 -
python __file__ 与相对路径
按相对路径./test.py来执行,则打印得到的是相对路径,按绝对路径执行则得到的是绝对路径。而按用户目录来执行(~/practice/test.py),则得到的也是绝对路径(~被展开) 所以为了得到绝对路径,我们需要 os.path.realpath(__file__)。原创 2013-07-12 14:30:50 · 56 阅读 · 0 评论 -
python 的 一些小用法
同一个 id() eg: name = “zijixiangsui” id(name)原创 2013-07-16 10:09:42 · 75 阅读 · 0 评论 -
命令行自动打开多个命令窗口,并进入到指定的目录中,或者自动登录多台
import os #pcList=['47','48','49','60','61','94'] #pcList=['151','152','153','154', '155','156'] pcList=['18','19','31'] for i in pcList: os.system("guake -n 1") os.system("guake -r %s"%i) os.system("guake -e 'ssh root@172.16原创 2013-07-26 10:17:12 · 511 阅读 · 0 评论 -
python资料整理
原创 2013-08-09 15:16:30 · 51 阅读 · 0 评论 -
python 文件处理
txt', 'w') # open for 'w'ritingf.write(poem) # write text to filef.close() # close the filef = file('poem.txt')# if no mode is specified, 'r'ead mode is assumed by defaultwhile True: line = f.readline() if len(line) == 0: # Zero length indicates EOF原创 2013-08-10 09:24:55 · 72 阅读 · 0 评论 -
python 入门 ,python简明教程
教程《简明 Python 教程》为 "A Byte of Python" 的唯一指定简体中文译本,版权 © 2005 沈洁元本书依照 创作公用约定(署名-非派生作品-非商业用途) 发布。概要无论您刚接触电脑还是一个有经验的程序员,本书都将有助您学习使用Python语言。目录表前言本书的读者本书的由来本书目前的状况官方网站约定条款欢迎给我反馈值得思考的一些东西1. 介绍简介Python的特色 概括为什么不使用Perl?程序员的原创 2013-08-11 08:44:35 · 182 阅读 · 0 评论 -
python 精通 ,python深入教程
n GNU/Linux 上的 Python1.7. 从源代码安装 Python1.8. 使用 Python 的交互 Shell1.9. 小结2. 第一个 Python 程序2.1. 概览2.2. 函数声明2.2.1. Python 和其他编程语言数据类型的比较2.3. 文档化函数2.4. 万物皆对象2.4.1. 模块导入的搜索路径2.4.2. 何谓对象?2.5. 代码缩进2.6. 测试模块3. 内置数据类型原创 2013-08-11 08:43:44 · 135 阅读 · 0 评论 -
Python yield 使用浅析
原创 2013-09-29 14:21:15 · 39 阅读 · 0 评论 -
python 时间格式化
和时间信息的确切表示方法。格式串中的其他字符原样放进串中。格式命令列在下面,它们是区分大小写的。%a 星期几的简写%A 星期几的全称%b 月分的简写%B 月份的全称%c 标准的日期的时间串%C 年份的后两位数字%d 十进制表示的每月的第几天%D 月/天/年%e 在两字符域中,十进制表示的每月的第几天%F 年-月-日%g 年份的后两位数字,使用基于周的年%G 年分,使用基于周的年%h 简写的月份名%H 24小时制的小时%I 12小时制的小时%j 十进制表示的每年的第几天%m 十进制表示的月份%M 十时制表原创 2013-05-23 15:41:02 · 65 阅读 · 0 评论 -
python基本数据类型
原创 2013-05-22 14:33:56 · 47 阅读 · 0 评论 -
python 参数格式化getopt
ptError:sys.exit()for name,value in options:if name in ("-h","--help"):usage()if name in ("-i","--ip"):print 'ip is----',valueif name in ("-p","--port")print 'port is----',value 使用方式:python原创 2013-10-08 11:32:59 · 132 阅读 · 0 评论