摘要: 1. a="hello" print(type(a) == str) # 推荐这样来判断类型 print(isinstance(a,str)) # python中,推荐这样来判断类型 2.isinstance(...),另外一种用法。 isinstance(...) 第二个参数是一个元组,判断对象a 阅读全文
posted @ 2022-05-28 22:51 repinkply 阅读(20) 评论(0) 推荐(0)
摘要: 1.逻辑运算符 print(1 and 0) # 输出0 print(1 and 0) #输出0 print(1 and 2) #输出2 print(2 and 1) #输出1 print(3 and 5) #输出5 print(5 and 3) #输出3 print(0 or 1) #输出1 pr 阅读全文
posted @ 2022-05-28 22:35 repinkply 阅读(33) 评论(0) 推荐(0)
摘要: a = (1,2,3,[1,2,4]) print(a[3][0]) # 输出1 print(a[3][1]) # 输出2 print(a[3][2]) # 输出4 b =(1,2,3,[1,2,[3,4,5,6]]) print(b[3][2][0]) # 输出3 print(b[3][2][1] 阅读全文
posted @ 2022-05-28 18:50 repinkply 阅读(10) 评论(0) 推荐(0)