摘要: shell里面显示字符串有时候是彩色的,python的都很单调,现在python的print也可以实现相同的输出。 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 阅读全文
posted @ 2017-07-21 16:10 无痕5201314 阅读(416) 评论(0) 推荐(0) 编辑
摘要: 1 s='hello alex alex say hello sb sb' 2 dic={} 3 words=s.split() 4 for word in words: 5 if word not in dic: 6 dic[word]=1 7 else: 8 dic[word]+=1 利用set 阅读全文
posted @ 2017-07-21 15:47 无痕5201314 阅读(486) 评论(0) 推荐(0) 编辑
摘要: 方法二: msg_dic={ 'apple':10, 'tesla':100000, 'mac':3000, 'lenovo':30000, 'chicken':10, } goods_l=[] while True: for k in msg_dic: print('NAME:\033[41m<{ 阅读全文
posted @ 2017-07-21 15:35 无痕5201314 阅读(138) 评论(0) 推荐(0) 编辑