목록 항목이 있는지 Python 확인
목록 항목이 있는지 확인
지정된 항목이 목록에 있는지 확인하려면 다음 in
키워드 를 사용하십시오.
예시
목록에 "apple"이 있는지 확인하십시오.
thislist = ["apple", "banana", "cherry"]
if "apple" in thislist:
print("Yes, 'apple' is in the fruits list")
지정된 항목이 목록에 있는지 확인하려면 다음 in
키워드 를 사용하십시오.
목록에 "apple"이 있는지 확인하십시오.
thislist = ["apple", "banana", "cherry"]
if "apple" in thislist:
print("Yes, 'apple' is in the fruits list")