123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- def TuplefindInList(lists: list, args):
- for l in lists:
- if args in l:
- return l
- return None
- def TuplefindInList1(lists: list, args, numb): #单一条件查询
- res = []
- if lists:
- for l in lists:
- if args == l[numb]:
- res.append(l)
- break
- return res
- def TuplefindInList11(lists: list, args, numb): #单一条件查询
- res = []
- if lists:
- for l in lists:
- if args == l[numb]:
- res.append(l)
- return res
- def TuplefindInList111(lists: list, args): #单一条件查询
- res = []
- if lists:
- for l in lists:
- for numb in range(3, 9):
- if args == l[numb].replace("*",""):
- res.append(l)
- break
- return res
- def TuplefindInList2(lists: list, args, args2, numb): # 或双条件查询
- res = []
- if lists:
- for l in lists:
- if args == l[numb] or args2 == l[numb]:
- res.append(l)
- return res
- def TuplefindInList3(lists: list, args, numb,neednumb): #唯一单一条件查询 并获取指定字段 #字符串类型
- res = ""
- if lists:
- for l in lists:
- if args == l[numb]:
- res = l[neednumb]
- break
- return res
- def TuplefindInList33(lists: list, args, numb,neednumb): #唯一单一条件查询 并获取指定字段 #字符串类型
- res = []
- if lists:
- for l in lists:
- if args == l[numb]:
- res.append(l[neednumb])
- return res
- def TuplefindInList4(lists: list, args, numb): # #唯一单一条件查询 并获取指定字段#列表类型
- res = []
- if lists:
- if lists !=None and len(lists) != 0:
- for l in lists:
- if args == l[numb]:
- res=l[2]
- return res
- def TuplefindInList5(lists: list, numb, args,numb2, args2): #且双条件查询
- res = []
- if lists:
- for l in lists:
- if args == l[numb] and args2 == l[numb2]:
- res.append(l)
- return res
- def TuplefindInList6(lists: list, args, args2, args3, numb): # 或三条件查询
- res = []
- if lists:
- for l in lists:
- if args == l[numb] or args2 == l[numb] or args3 == l[numb]:
- res.append(l)
- return res
- def TuplefindInList7(lists: list, args, numb,numb2): #单一条件查询 且返回指定字段字符串
- res = ""
- if lists:
- for l in lists:
- if args == l[numb]:
- res=res+"、"+l[numb2] if res != "" else l[numb2]
- return res
- def TuplefindInList8(lists: list, args, numb): #单一条件查询不等于
- res = []
- if lists:
- for l in lists:
- if args != l[numb]:
- res.append(l)
- return res
- def TuplefindInList9(lists: list, numb): #单一条件查询求和
- res = 0
- if lists:
- for l in lists:
- if l[numb] !="":
- res = res+float(l[numb])
- return round(res,2)
|