2018年7月14日

for 循环遍历字典中的键值两种方法

摘要: 一、先获取key,然后通过dic[key]获取value import time dict = {'山东':'济南','河南':'郑州','江苏':'南京'} for key in dict: print(key) print(key,dict[key]) time.sleep(1) 江苏江苏 南京 阅读全文

posted @ 2018-07-14 17:44 糖糖大大 阅读(7036) 评论(0) 推荐(0) 编辑

python print函数之end

摘要: print函数默认换行,是end='\n'在起作用, print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False) 案例: >>> for i in range(10):print(i)0123456789 如果不想换行可以用 阅读全文

posted @ 2018-07-14 17:16 糖糖大大 阅读(30224) 评论(0) 推荐(0) 编辑

导航