[함수] 하나라도 리스트에 없으면 warning

안알랴줌·2023년 2월 15일
0

리마인드용 글쓰기

목록 보기
14/15
  • element in list를 사용했다

ex)

if not ((int(self.location) in list) and (int(self.locationa) in list) and (int(self.locationb) in list) and (int(self.locationc) in list) and (int(self.locationd) in list)):
	QMessageBox.information(self,'본부지사코드!', '존재하지 않는 본부지사코드가 있습니다. 확인해주세요.')
  • 예시에서는 and를 이용해서 한개라도 False가 나오면 False인데 조건문의 조건에 맞추기위해 not을 이용해서 조건에 맞춰줬다
profile
프로그래밍 공부중입니다, 고양이 안키웁니다

0개의 댓글