上一页 1 ··· 6 7 8 9 10 11 下一页
摘要: 随机验证码 import random b = '' for i in range(5): t = random.randrange(0, 9) if t==3 or t==0: y = random.randrange(0,9) u1 = str(y) else: j = random.randrange(65,91... 阅读全文
posted @ 2016-12-20 10:28 200ML 阅读(106) 评论(0) 推荐(0) 编辑
摘要: python内置函数 '''绝对值''' i = abs(-123) print(i) '''循环参数,如果每一元素都为True,那么all返回值为True,如果有一个为False,则返回结果为False. (0,None,空值 为假。)''' i =all([True,True,False]) print(i) ''' 循环参数只要有一个真,就为真 ''' i = any([True,... 阅读全文
posted @ 2016-12-20 09:56 200ML 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 判断 数字 字母 空格 总和 分别多少。 def funk_1(p): number = 0 letter = 0 space = 0 other = 0 for i in p: other += 1 if i.isdigit(): number += 1 elif i.isalp... 阅读全文
posted @ 2016-12-19 18:12 200ML 阅读(138) 评论(0) 推荐(0) 编辑
摘要: name = 'alxe' if 1 == 1 else 'abc'name = 值(1) if 条件 esle 值(2)print (name)深浅copy:str,一次性创建,不能被修改,只要修改,在创建。list,链表,下一个元素的位置,上一个元素的位置。srt,数字拷贝,赋值 地址都一样 阅读全文
posted @ 2016-12-19 11:28 200ML 阅读(125) 评论(0) 推荐(0) 编辑
摘要: ''' 把W合并到S里面,去除相同的元素,并更新S。 '''w = {11,22,33,44}s = {33,44,55,66}s.update(w)print(s)''' 合并两个列表,去除相同的元素,并赋值給一个变量。 '''w = {11,22,33,44}s = {33,44,55,66}e 阅读全文
posted @ 2016-12-19 10:11 200ML 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 一般字符串,执行一个功能,生成一个新内容,原来内容不变。list,tuple,dict,执行一个功能,自身进行变化。求 a 或 A 还有C 结尾的 元素 li = ['Alix',' aric','alix','Tonc','rain'] dic = {'k1':'Alix','k2':' aric','k3':'alix','k4':'Tony','k5':'ra 阅读全文
posted @ 2016-12-12 20:16 200ML 阅读(206) 评论(0) 推荐(0) 编辑
摘要: out = {'name':'Liu','age':22} print(out['name']) '''获取所有的键''' print(out.keys()) ''' 获取所有的值''' print(out.values()) '''获取所有的键值''' print(out.items()) '''根据K获取值,如果K不存在,可以指定一个默认值''& 阅读全文
posted @ 2016-12-12 14:09 200ML 阅读(151) 评论(0) 推荐(0) 编辑
摘要: '''删除指定索引位置'''del out[1]print(out) 阅读全文
posted @ 2016-12-12 12:55 200ML 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 数字 int 获取2进制最小位数 n = 5ret=n.bit_length()print(ret) a = '牛牛' #将字符串转换成字节。 b0 = bytes(a,encoding='utf-8') print(b0) b1 = bytes(a,encoding='jbk') #将字节转换字符 阅读全文
posted @ 2016-12-11 20:32 200ML 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 例(1) count_1 = True while count_1: print('1') print('2') count_1 = False print('3') 例(2) count_1 = True while count_1: print('1') print('2') count_1 = False print('3') 例(3) ... 阅读全文
posted @ 2016-12-10 12:44 200ML 阅读(196) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 下一页