摘要:
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
阅读(155)
评论(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
阅读(465)
评论(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
阅读(777)
评论(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
阅读(223)
评论(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
阅读(189)
评论(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
阅读(291)
评论(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
阅读(222)
评论(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
阅读(339)
评论(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
阅读(271)
评论(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
阅读(196)
评论(0)
推荐(0)
摘要:
import re'''method1============================================================'''def matchx(noun): return re.search('[szx]$', noun)def matchy(noun... 阅读全文
posted @ 2015-12-28 20:09
xfei.zhang
阅读(143)
评论(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
阅读(158)
评论(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
阅读(172)
评论(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
阅读(153)
评论(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
阅读(108)
评论(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
阅读(154)
评论(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
阅读(103)
评论(0)
推荐(0)
摘要:
CMakeCache.txt可以将其想象成一个配置文件(在Unix环境下,我们可以认为它等价于传递给configure的参数)。CMakeLists.txt 中通过 set(... CACHE ...) 设置的变量 CMakeLists.txt 中的 option() 提供的选项 CMakeList... 阅读全文
posted @ 2015-12-28 19:59
xfei.zhang
阅读(1097)
评论(0)
推荐(0)
摘要:
学习一下cmake的 finder。finder是神马东西?当编译一个需要使用第三方库的软件时,我们需要知道:去哪儿找头文件 .h对比GCC的 -I 参数去哪儿找库文件 (.so/.dll/.lib/.dylib/...)对比GCC的 -L 参数需要链接的库文件的名字对比GCC的 -l 参数这也是一... 阅读全文
posted @ 2015-12-28 19:58
xfei.zhang
阅读(265)
评论(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
阅读(151)
评论(0)
推荐(0)
摘要:
例子五前面还是有一点不爽:如果想让可执行文件在 bin 目录,库文件在 lib 目录怎么办?就像下面显示的一样: + build/ | +--+ bin/ | | | /--- hello.exe | /--+ lib/ | /--- hello.lib•一种办法:修改顶级的 CMakeList.t... 阅读全文
posted @ 2015-12-28 19:56
xfei.zhang
阅读(116)
评论(0)
推荐(0)
摘要:
例子三接前面的例子,我们将 hello.c 生成一个库,然后再使用会怎么样?改写一下前面的CMakeList.txt文件试试:project(HELLO)set(LIB_SRC hello.c)set(APP_SRC main.c)add_library(libhello ${LIB_SRC})ad... 阅读全文
posted @ 2015-12-28 19:55
xfei.zhang
阅读(130)
评论(0)
推荐(0)
摘要:
例子一: 单个源文件 main.c例子二: 分解成多个 main.c hello.h hello.c例子三: 先生成一个静态库,链接该库例子四: 将源文件放置到不同的目录例子五: 控制生成的程序和库所在的目录例子六: 使用动态库而不是静态库例子一一个经典的C程序,如何用cmake来进行构建程序呢?/... 阅读全文
posted @ 2015-12-28 19:54
xfei.zhang
阅读(237)
评论(0)
推荐(0)
摘要:
服务器端程序:import socketimport signalimport selectMAX_LISTEN_N = 100MAX_BUFFER_N = 1024mconnections = {}addresses = {}datalist = {}IP_ADDR = '192.168.1.2'... 阅读全文
posted @ 2015-12-28 19:48
xfei.zhang
阅读(241)
评论(0)
推荐(0)
摘要:
假设有Json串如下:{ "cmd" : "request1", "account" : "com", "rcode" : 0, "result" : 1, "list" : [ { "info" : { "timestamp" : 123123212, "seri... 阅读全文
posted @ 2015-12-28 19:44
xfei.zhang
阅读(283)
评论(0)
推荐(0)
摘要:
Json是一种数据存储格式,涉及的数据类型主要分为以下五种,只要熟悉下面的5张图片对json的处理就会手到擒来。参考文献:http://www.json.org/https://developer.gnome.org/json-glib/1.0/object{}{ members } members... 阅读全文
posted @ 2015-12-28 19:24
xfei.zhang
阅读(149)
评论(0)
推荐(0)
摘要:
==============coredump文件产生设置=====release版本coredump的调试===============================================================无-g编译的coredump以后怎么定位问题。以前都是用debug... 阅读全文
posted @ 2015-12-28 19:20
xfei.zhang
阅读(1194)
评论(0)
推荐(0)
摘要:
GDB 调试-------------------------------------------------------------------------------gdb 帮助文档help -- 查看 gdb 的命令种类help -- 查看 CmdType 种类的 gdb 命令apropos... 阅读全文
posted @ 2015-12-28 19:19
xfei.zhang
阅读(416)
评论(0)
推荐(0)
摘要:
编译生成执行文件:(Linux下)cc -g tst.c -o tst使用GDB调试:hchen/test> gdb tst 23 int func(int n)4 {5 int sum=0,i;6 for(i=0; i使用GDB一般来说GDB主要调试的是C/C++的程序。要调试C/C++的程序,首... 阅读全文
posted @ 2015-12-28 19:16
xfei.zhang
阅读(187)
评论(0)
推荐(0)

浙公网安备 33010602011771号