摘要: 1. 如何查找自动加载的模块>>> import builtins>>> dir(builtins) 2. 如何知道函数返回的数据类型type(object)3.文件夹操作os.os.pathshutil.4.字符串操作str5.调用shell命令(详见shell.txt)a. os.system... 阅读全文
posted @ 2015-12-28 20:19 xfei.zhang 阅读(123) 评论(0) 推荐(0) 编辑
摘要: import urllib.request as urimport http.client as hcimport httplib2import urllib.parse as updef httplibtwo1(): print('===================httplib2===... 阅读全文
posted @ 2015-12-28 20:18 xfei.zhang 阅读(419) 评论(0) 推荐(0) 编辑
摘要: util_m.py:import sysdef util_test(string): ''' parameter description: string: string of object return none ''' print(string)lis... 阅读全文
posted @ 2015-12-28 20:16 xfei.zhang 阅读(758) 评论(0) 推荐(0) 编辑
摘要: '''TDD: test drive develop'''import unittestimport util_mclass myunittestclass(unittest.TestCase): '''must be the child class of unittest.TestCase'... 阅读全文
posted @ 2015-12-28 20:15 xfei.zhang 阅读(212) 评论(0) 推荐(0) 编辑
摘要: '''import xml.etree.ElementTree as etreeElementTree is default python module, but it is slow, function is limitedso , we can import etree from lxml, i... 阅读全文
posted @ 2015-12-28 20:13 xfei.zhang 阅读(185) 评论(0) 推荐(0) 编辑
摘要: import urllib.request as urimport http.client as hcimport httplib2import urllib.parse as updef http1(): print('==========http1=====================... 阅读全文
posted @ 2015-12-28 20:12 xfei.zhang 阅读(262) 评论(0) 推荐(0) 编辑
摘要: import localeimport ioimport gzipimport sysclass RedirectStdoutTo: def __init__(self, out_new): self.out_new = out_new def __enter__(self... 阅读全文
posted @ 2015-12-28 20:11 xfei.zhang 阅读(214) 评论(0) 推荐(0) 编辑
摘要: import itertoolsimport subprocessimport util_m'''it is for shell command'''import builtins'''it is loaded into memory when python module starts'''clas... 阅读全文
posted @ 2015-12-28 20:10 xfei.zhang 阅读(333) 评论(0) 推荐(0) 编辑
摘要: import pickleimport pickletoolsimport jsondef pickle1(): list1={} list1['name']='jack' list1['age']=22 with open('data.pickle', mode='wb')... 阅读全文
posted @ 2015-12-28 20:10 xfei.zhang 阅读(265) 评论(0) 推荐(0) 编辑
摘要: '''help----os, help----glob'''import osimport timeimport globprint(os.getcwd())os.chdir('/home/tizen/share')print(os.getcwd())path='/home/tizen/share/... 阅读全文
posted @ 2015-12-28 20:09 xfei.zhang 阅读(194) 评论(0) 推荐(0) 编辑