摘要: 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 阅读(755) 评论(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 阅读(211) 评论(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 阅读(184) 评论(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 阅读(258) 评论(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 阅读(211) 评论(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 阅读(329) 评论(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 阅读(264) 评论(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 阅读(193) 评论(0) 推荐(0) 编辑
摘要: import re'''method1============================================================'''def matchx(noun): return re.search('[szx]$', noun)def matchy(noun... 阅读全文
posted @ 2015-12-28 20:09 xfei.zhang 阅读(137) 评论(0) 推荐(0) 编辑
摘要: '''help----re'''import restring1='100 NORTH BROAD MAIN ROAD. 100'print(string1.replace('ROAD.', 'RD.'))print(re.sub('ROAD$', 'RD.', string1))print(re.... 阅读全文
posted @ 2015-12-28 20:08 xfei.zhang 阅读(138) 评论(0) 推荐(0) 编辑
摘要: '''help--string'''import sysimport util_mlist_1=[1,43,161,12]i=0for item in list_1: if item%2!=0: print(item) i=i+1 else: b... 阅读全文
posted @ 2015-12-28 20:07 xfei.zhang 阅读(164) 评论(0) 推荐(0) 编辑
摘要: '''help---tuple1. can not change 2. only can access'''my_tuple=('data1',222,222,'data3',333,444,'jang')print(my_tuple)print(my_tuple[0])print(my_tuple... 阅读全文
posted @ 2015-12-28 20:06 xfei.zhang 阅读(137) 评论(0) 推荐(0) 编辑
摘要: '''help---set, 1. no sequencial, random2. no repeated value'''my_set={1,'data1',2,'value'}print(my_set)a_list = [1,2,3]tt_set=set(a_list)print(tt_set)... 阅读全文
posted @ 2015-12-28 20:05 xfei.zhang 阅读(131) 评论(0) 推荐(0) 编辑
摘要: '''help--list1.not special restrict'''a_list = ['xfei',22,'nanjing']print(a_list)print(a_list[2])print(a_list[-1])print(a_list[0])print(a_list[-3])pri... 阅读全文
posted @ 2015-12-28 20:05 xfei.zhang 阅读(105) 评论(0) 推荐(0) 编辑
摘要: '''help---dict1. key-value2. key is not repeated, later key value will cover old key value'''dict1={'name':'xfei','age':20, 'favorite':['swimming','si... 阅读全文
posted @ 2015-12-28 20:04 xfei.zhang 阅读(99) 评论(0) 推荐(0) 编辑
摘要: CMakeCache.txt可以将其想象成一个配置文件(在Unix环境下,我们可以认为它等价于传递给configure的参数)。CMakeLists.txt 中通过 set(... CACHE ...) 设置的变量 CMakeLists.txt 中的 option() 提供的选项 CMakeList... 阅读全文
posted @ 2015-12-28 19:59 xfei.zhang 阅读(1030) 评论(0) 推荐(0) 编辑
摘要: 学习一下cmake的 finder。finder是神马东西?当编译一个需要使用第三方库的软件时,我们需要知道:去哪儿找头文件 .h对比GCC的 -I 参数去哪儿找库文件 (.so/.dll/.lib/.dylib/...)对比GCC的 -L 参数需要链接的库文件的名字对比GCC的 -l 参数这也是一... 阅读全文
posted @ 2015-12-28 19:58 xfei.zhang 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 简单的语法•注释# 我是注释•命令语法COMMAND(参数1 参数2 ...)•字符串列表A;B;C # 分号分割或空格分隔的值•变量(字符串或字符串列表)set(Foo a b c)设置变量 Foocommand(${Foo})等价于 command(a b c)command("${Foo}")... 阅读全文
posted @ 2015-12-28 19:57 xfei.zhang 阅读(142) 评论(0) 推荐(0) 编辑