码迷,mamicode.com
首页 > 编程语言 > 详细

python 模块整理

时间:2017-07-24 14:47:41      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:图片   cgi   osi   formatter   rom   list   返回   time   thread   

---文件、系统---

import glob  # 给定路径下查找符合规则文件。三个匹配符:”*”, “?”, “[]”。”*”匹配0个或多个字符;”?”匹配单个字符;”[]”匹配指定范围内的字符,如:[0-9]匹配数字。

print glob.glob("../*/*.jpg")  # 返回数组

import os

import sys

import time

 

 

---字符串---

import string  # 字符串相关,譬如大小写改变,字符判断

from string import Formatter  # 字符串替换。通过position和keyword来指定替换对象

"my name is {0.name}, I am living at {area[0].city}".format(person, area_list)

from string import Template  # 字符串替换。默认通过$来指定替换对象

header = ‘‘‘<title>$title</title>‘‘‘

header.substitute(title=the_title)

参考文档:

http://blog.csdn.net/xiaoxiaoniaoer1/article/details/8542834

http://www.cnblogs.com/rollenholt/archive/2011/11/25/2263722.html

http://www.cnblogs.com/youngershen/p/3972009.html

 

---网络---

BaseHTTPServer 

http://blog.csdn.net/linda1000/article/details/8087546

SimpleHTTPServer  # HTTP 服务

CGIHTTPServer  # CGI 服务

注意!有CGI脚本时,应该用CGIHTTPServer启服务,如果SimpleHTTPServer的话,会直接展示脚本内容

 

---多线程---

import threading

 

 

 

---图片---

python 模块整理

标签:图片   cgi   osi   formatter   rom   list   返回   time   thread   

原文地址:http://www.cnblogs.com/silvi/p/7228442.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!