随笔分类 -  python

摘要:`for key in 字典 for value in 字典.values() for key, value in 字典.items()` 阅读全文
posted @ 2021-12-30 12:03 漂流海上的草帽 阅读(49) 评论(0) 推荐(0)
摘要:dict1={'name':'Lara','age':18} #判断键在不在字典中 for one in dict1: if 'name' in dict1:#或dict1.keys() print('key在字典中!') break #判断值在不在字典中 for one in dict1: if 阅读全文
posted @ 2021-04-15 19:36 漂流海上的草帽 阅读(1094) 评论(0) 推荐(0)
摘要:python之输入一组数已空格为间隔 输入两个数以空格为间隔(多个同理) a,b=map(int,input().split.()) print(a,b) 输入多个单词以逗号为间隔 str1,str2=map(str,input.split(',')) print(str1,str2) 输入一组数, 阅读全文
posted @ 2021-03-24 22:44 漂流海上的草帽 阅读(1102) 评论(0) 推荐(0)