06 2014 档案
摘要:用法: char dst[256] = {0}; char *src = "src"; strncpy(dst, src, sizeof(dst) - 1);
阅读全文
摘要:str1 = ""str2 = Nonestr3 = "hello"if str2: print "not null"else: print "null"这样,不仅可以判定字符串是否为空,还能判定是否为None
阅读全文
摘要:比较中文是否相等:if str1.decode("GB2312").encode("utf-8") ==str2.decode("GB2312").encode("utf-8"): print "=="注: decode中时str1 str2使用的中文编码方式, encode统一用utf-8形式比...
阅读全文
摘要:#!/usr/bin/env python# -*- coding: utf-8 -*-############################################## File : requestAnyURLWithCookie.py# Author : luc...
阅读全文
摘要:#!/usr/bin/env python# -*- coding: utf-8 -*-############################################## File : loginMMVOIP.py# Author : lucasysfeng# Re...
阅读全文
摘要:b1=b2=""b3="hello"if [[ -n "${b3}" ]]then echo "not null"else echo "null"fib1 nullb2 nullb3 not null-n str 字符串长度非零
阅读全文
摘要:import rereg = re.compile(r"voip", re.IGNORECASE)print reg.findall("23oipvoipsnvoipc")输出['voip', 'voip']findall() 找到 RE 匹配的所有子串,并把它们作为一个列表返回http://wik...
阅读全文
摘要:import datetimedatetime有几个常用类:date time datetime timedelta1. 今天日期时间(今天时间)>>> import datetime>>> now = datetime.datetime.now()>>> print now2014-06...
阅读全文
摘要:1. 显示当前日期时间.$ dateMon Jun 2 13:55:47 HKT 2014当前时间戳:date +%s2. 按照指定格式显示当前时间(date +format).(1). 显示年月日.$ date "+%Y-%m-%d"2014-06-02$ date "+%F"2014-06-0...
阅读全文
摘要:du -h --max-depth=1注: 如果没有--max-depth=1,则会递归显示所有目录,这通常不是我们需要的,因此一班加上要查的深度.df 命令是查看文件系统给的大小.
阅读全文

浙公网安备 33010602011771号