摘要:
import re def end_num(string): #以一个数字结尾字符串 text = re.compile(r".*[0-9]$") if text.match(string): return True else: return False print(end_num('abcdef'... 阅读全文
摘要:
def is_decimal(num): import re #以数字开头,小数点后保留1位数字或两位数字或者没有小数部分 dnumre = re.compile(r"""^[0-9]+(\.[0-9]{1,2})?$""") result = dnumre.search(num) return bool(result) prin... 阅读全文
摘要:
将结尾的Road用Rd.替换 阅读全文
摘要:
x = frozenset([1, 2, 3, 4, 5]) y = frozenset([3, 4, 5, 6, 7]) #如果x与y没有公共元素,返回true print(x.isdisjoint(y)) #返回x与y不一样的元素 print(x.difference(y)) #返回x与y并集 print(x | y) 阅读全文
摘要:
setx = set(["apple", "mango"]) sety = set(["mango", "orange"]) setz = set(["mango"]) issubset = setx = sety print(issuperset) issubset = setz = setz print(issuperset) 阅读全文
摘要:
num_set = set([0, 1, 3, 4, 5]) num_set.pop() print(num_set) num_set.pop() print(num_set) 阅读全文
摘要:
#Create a new set num_set = set([0, 1, 2, 3, 4, 5]) #Discard number 4 num_set.discard(4) print(num_set) 阅读全文
摘要:
// xxx.h namespace A { #define xxx() xxxxx } // 在其他文件中,引入xxx.h文件,使用宏定义时,不需要加命名空间 // yyy.cpp #include "xxx.h" // somd code void func() { // 正确 xxx() } 阅读全文
摘要:
例子一 输出: 例子二: 输出: 阅读全文
摘要:
#!/bin/bash # 当/var/log/syslog大于68B时 if ! [ -f /var/log/syslog ] then echo "file not exist!" exit 1 fi if [ `ls -l /var/log/syslog|awk '{print $5}'` -gt $(68) ] then cat /var/log/syslog >>... 阅读全文
摘要:
crontab -e 输出如下 然后就会打开一个文件,什么都不用做,直接保存,保存方式类似vim 再次crontab -l ,就会显示出定时任务了 阅读全文