摘要: >>> from random import randint>>> a = randint(5,10) # 产生一个5到10之间(包括5和10)的随机整数。 >>> import random>>> b = random.randint(5,10) range(10) # range(1,10) 不 阅读全文
posted @ 2018-12-31 04:25 梦想召唤未来 阅读(96) 评论(0) 推荐(0)
摘要: list 常用方法 增 list.extend(元素) #增加可迭代对象 >>> s.extend('adfadf') >>> s ['6854', '5655', '465', '454', '45', '45', '44', '', 'a', 'd', 'f', 'a', 'd', 'f'] l 阅读全文
posted @ 2018-12-31 04:25 梦想召唤未来 阅读(123) 评论(0) 推荐(0)
摘要: nonlocal关键字 global 关键字 globals and locals 方法 阅读全文
posted @ 2018-12-31 04:25 梦想召唤未来 阅读(70) 评论(0) 推荐(0)
摘要: 字符串的操作方法 作业 # n = ' aleX lenb ' # print(n.strip()) # # name = 'aleX leNb' # print(name.lstrip('al')) # # print(name.rstrip('Nb')) # # print(name[1:-1] 阅读全文
posted @ 2018-12-31 04:24 梦想召唤未来 阅读(150) 评论(0) 推荐(0)
摘要: 去除两端字符方法 strip 格式化输出format 替换replace, 形成新的str is 系列 str 方法string.split()方法,默认空格, list('sdfsdfsdfs dfds') #将string中所有元素转 为list,包括空格字符串赋值或者直接使用也可以。'whan 阅读全文
posted @ 2018-12-31 04:24 梦想召唤未来 阅读(129) 评论(0) 推荐(0)