import MySQLdb//定义引用数据库的驱动文件import serialimport timeser = serial.Serial('/dev/ttyATH0', 115200, timeout=65)//读串口while True:data = ser.readline()print ...
分类:
数据库 时间:
2014-11-12 13:30:59
阅读次数:
279
一篇关于str和Unicode的好文章整理下python编码相关的内容注意: 以下讨论为Python2.x版本, Py3k的待尝试开始用python处理中文时,读取文件或消息,http参数等等一运行,发现乱码(字符串处理,读写文件,print)然后,大多数人的做法是,调用encode/decode进...
分类:
编程语言 时间:
2014-11-12 00:20:19
阅读次数:
35943
array_flip()例子 1, "b" => 1, "c" => 2);$trans = array_flip($trans);print_r($trans);?> 答案:Array( [1] => b [2] => c)array_values() 例子 "XL", "color"...
分类:
其他好文 时间:
2014-11-11 21:03:15
阅读次数:
179
#include #include #include #include #include #include #include #include #include using namespace std;void F(int a){ cout & vi){ coutvoid Print(T t){ ....
分类:
编程语言 时间:
2014-11-11 15:53:22
阅读次数:
198
可变参数def enroll(name, gender, age=6, city='Beijing'): print 'name:', name print 'gender:', gender print 'age:', age print 'city:', city调用:e...
分类:
编程语言 时间:
2014-11-11 12:20:57
阅读次数:
240
切片切片就是获取一个list、tuple、字符串等的部分元素 1 l = range(100) 2 #取[0,5)元素 3 print(l[:5]) #[0, 1, 2, 3, 4] 4 #在[0,99]中每隔10个元素取一个 5 print( l[::10]) #[0, 10, 20, 3...
分类:
编程语言 时间:
2014-11-11 10:41:41
阅读次数:
213
1、用PHP打印出前一天的时间格式是2006-5-10 22:21:21(2分)$a = date("Y-m-d H:i:s", strtotime("-1 day"));print_r($a); 2、echo(),print(),print_r()的区别(3分)echo 和print不是一个函数....
分类:
Web程序 时间:
2014-11-10 21:08:38
阅读次数:
242
今天调用webservice时返回一个字段是int64 长整型 原始的数值应该是190000002101056096 而php返回时转成1.9000000210106E+17当传入另一个接口就报错了解决方法$c=1.9000000210106E+17;1number_format()number_f...
分类:
Web程序 时间:
2014-11-10 19:39:32
阅读次数:
247
1、查看Web服务器(Nginx Apache)的并发请求数及其TCP连接状态:
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
netstat -n|grep ^tcp|awk '{print $NF}'|sort -nr|uniq -c
或者:
netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"t",stat...
分类:
系统相关 时间:
2014-11-10 15:33:08
阅读次数:
227
Given a binary tree, a target node in the binary tree, and an integer value k, print all the nodes that are at distance k from the given target node. ...
分类:
其他好文 时间:
2014-11-09 23:30:26
阅读次数:
235