2017年6月5日

udp拼接传递数据包

摘要: 1.拼接项少 pl = ["<0112>","<32>","<1024x768>","<60>","<1>","100.0"] s = '' for p in pl: s += p; 2.拼接项多 ' '.join(str(x) for x in pl) 阅读全文

posted @ 2017-06-05 16:34 passli 阅读(608) 评论(0) 推荐(0) 编辑

判断字符串a是否以字符串b开头或结尾

摘要: 使用字符串的 str.startwith() 和 str.endswith()方法 import os , stat for name in os.listdir('.') if name.endswith('py','sh') 调整字符串中文本的格式 import re log = open('/ 阅读全文

posted @ 2017-06-05 16:22 passli 阅读(1128) 评论(0) 推荐(0) 编辑

拆分多种分隔符的字符串

摘要: 1. def MySplit(x,ds): res = [x] for d in ds: t = [] map(lambda x: t.extend(x.split(d)),res) res = t return (x for x in res if x) x = "ads,ds;sd?dsds\t 阅读全文

posted @ 2017-06-05 15:57 passli 阅读(230) 评论(0) 推荐(0) 编辑

导航