# name = input("请输入你的名字:")
# print("%s是个傻吊"%name)
# age = input("请输入你的年龄:")
# age = int(age)#这个东西可以把字符串转一下
# print("它的年龄是%d" % age)
# age = 12
# name = "asdfsd王大可"
# address = "天堂"
# print("姓名是:%s,年龄是:%d,地址是:%s" % (name, age, address))
#
# a = 6
# if a == 5:
# print("111111111111")
# elif a == 6:
# print("222222222222")
# elif a == 7:
# print("7777")
# i = 1
# while i <= 5:
# j = 1
# while j <= 5:
# if j <= i:
# print("*", end='')
# else:
# print(" ", end="")
# j += 1
# print("")
# i += 1
# i = 1
# while i <= 9:
# j = 1
# while j <= 9:
# if j <= i:
# print(str(j) + "*" + str(i) + "=" + str(i * j)+" ", end='')
# else:
# print(" ", end="")
# j += 1
# print("")
# i += 1
# name = "minimingwang"
# for char in name:
# if char=="n":
# # break
# continue
# print(char)
# print(len(name))#打印字符串长度
# print(name[5]) #下标还是从0开始
# print(name[-1]) #如果是负的话,从后往前取,其实就是位溢出了
# print(name[2:5]) #取2,3,4位字符组成串,老规矩包左不包右
# print(name[3:len(name)]) #取了3到最后的
# print(name[3:]) #如果最后一个数没写,默认取到最后
# print(name[3:-1:2]) # -1也是取到最后,2表示步长,每隔两个取一个出来
# print(name[::-1]) #所以,三个参数,1为起始,二为结束索引,三为步长,可为负
# print(name[-1:0:-1]) #所以,三个参数,1为起始,二为结束索引,三为步长,可为负
# names = ["老张", "老王", "张三", 6666, True]
# names.append(False) #增
# names.insert(3, "fuck") #插入到指定索引的位置
# new_names = ["第二个", "第三个"]
# names.append(new_names) #把第二个列表以元素方式加入第一个列表中
# names.extend(new_names) #合列表
# pop = names.pop() #删除最后一个
# print(pop)
# names.remove("张三") #删除第一个匹配上的
# del names[0] #根据下标删
# print(names[-1::-1]) #列表切片跟字符串一样的
# if "张三" in names: #可以用这个方式判断列表中是否有这个元素
# print("张三在其中")
# print(names)
#字典,妈的完全就json啊
# info_maps = {"name": "老王", "age": 23, "height": "180米"}
# # print("名字是%s,年龄是%d,身高是%s" % (info_maps["name"], info_maps["age"], info_maps["height"]))
# info_maps["qq"] = 654321987 #添加,或修改
# info_maps[23] = 234123 #删除
# del info_maps[23]
#
# print(info_maps.get("name"))#使用get也能获取,并且避免key不存在时出现异常
# print(info_maps)
infos = [{"name":"老王","age":23},
{"name":"老asdf","age":223},
{"name":"adf王","age":243}]
fortempininfos:
print(temp["name"],end="\t")
网友评论