上一页 1 ··· 3 4 5 6 7 8 下一页
摘要: a=[1,2,3,4]print(repr(a))print(type(repr(a)))for i in repr(a): print(i)#repr函数是将对象转换成string类型 阅读全文
posted @ 2017-09-07 20:16 糖宝虫 阅读(317) 评论(0) 推荐(0) 编辑
摘要: import randoma=[]for i in range(9): b=random.randint(0,9)#生产9个随机数 a.append(b)#把生成的随机数添加到列表里面print(sorted(a))#对列表进行排序 阅读全文
posted @ 2017-09-07 17:02 糖宝虫 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 需要逆向循环序列的话,先正向定位序列,然后调用 reversed() 函数。 for i in reversed(range(1, 10, 2)): print(i)97531 阅读全文
posted @ 2017-09-07 15:21 糖宝虫 阅读(187) 评论(0) 推荐(0) 编辑
摘要: a=[1,2,3]b=[4,5,6]for A ,B in zip(a,b):#用zip()函数整体打包 print(A,B) 阅读全文
posted @ 2017-09-07 15:19 糖宝虫 阅读(102) 评论(0) 推荐(0) 编辑
摘要: d={"A":"a","B":"b","C":"c","D":"d"}c=d.items()#字典(Dictionary) items() 函数以列表返回可遍历的(键, 值) 元组数组。for a,b in c: print(a,b)b=enumerate(c)#对于一个可迭代的(iterable) 阅读全文
posted @ 2017-09-07 14:55 糖宝虫 阅读(170) 评论(0) 推荐(0) 编辑
摘要: for i in range(10): if i==5: continue #跳出当次循环 if i==8: break #跳出整个for循环 print(i) 阅读全文
posted @ 2017-08-31 20:45 糖宝虫 阅读(131) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2017-08-22 23:35 糖宝虫 阅读(1) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2017-08-20 23:19 糖宝虫 阅读(1) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2017-08-08 00:12 糖宝虫 阅读(5) 评论(0) 推荐(0) 编辑
摘要: name:lysother1other2other3e:10000c:sexd:Japan 这里还有一个关于赋值的问题: 阅读全文
posted @ 2017-08-07 00:11 糖宝虫 阅读(149) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 下一页