Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- label
- Visual Studio
- C++
- pip
- pandas
- error
- C#
- 핑거스타일
- C
- VS Code
- Docker
- 프로그래머스
- OpenCV
- 기타 연주
- paramiko
- windows forms
- 오류
- Python
- Linux
- pytorch
- 컨테이너
- Numpy
- JSON
- SSH
- Selenium
- nvidia-smi
- ubuntu
- mysql
- YOLO
- 채보
Archives
- Today
- Total
기계는 거짓말하지 않는다
Python String에 여러 요소가 있는지 판별 본문
in을 사용해서 하나의 요소가 있는지 판별 가능하다.
ex) if e in string:
여러 요소를 한꺼번에 판별하고 싶을 때 any와 for을 함께 사용한다.
# 판별하고 싶은 요소
element = ["One", "Two", "Three", "Four"]
# 요소들이 들어있거나 들어있지 않은 string
string_list = ["abcdOneqwerThreeABCD", "cvbnmtyui", "ertyui", "NNNNNFour"]
for string in string_list:
if any(e in string for e in element):
print(string)
'Python' 카테고리의 다른 글
Python 예외 처리(Exception) (0) | 2021.09.05 |
---|---|
Python DataFrame 특정 값 추출 (0) | 2021.09.04 |
Python argparse module (0) | 2021.08.28 |
Python 파일 이름 변경 (0) | 2021.08.19 |
Python Numpy any Filter (0) | 2021.08.15 |
Comments