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 |
Tags
- MacOS
- computer
- MIPS
- CSS
- Linux
- Class
- XML
- github
- architecture
- control
- web
- function
- system
- DoM
- while
- Algorithm
- react
- mysql
- for
- instruction
- javascript
- python
- html
- Pipelining
- DS
- DB
- data structure
- Java
- php
- DATAPATH
Archives
- Today
- Total
YYYEJI
[Python] find, startswith, endswith 함수 본문
728x90
find - 특정 문자의 Index를 반환해 줍니다.
startswith - parameter로 받은 문자가 시작문자열이면 True 아니면 False를 반환해 줍니다.
endswith - parameter로 받은 문자가 끝나는 문자열이면 True 아니면 False를 반환해 줍니다.
Find 함수
abc = "ABCDEFG"
print(abc.find("A"))
print(abc.find("D"))
print(abc.find("G"))
Startswith 함수
abc = ["Aa", "Bb", "Cc", "Dd"]
for alpha in abc:
print(alpha.startswith("B"))
abc = ["Aa", "Bb", "Cc", "Dd"]
for alpha in abc:
if alpha.startswith("B"):
print(alpha)
Endswith 함수
abc = ["Aa", "Bb", "Cc", "Dd"]
for alpha in abc:
print(alpha.endswith("c"))
abc = ["Aa", "Bb", "Cc", "Dd"]
for alpha in abc:
if alpha.endswith("c"):
print(alpha)
◡̈
'Python' 카테고리의 다른 글
[Python] 반복문 (while문) (0) | 2022.09.29 |
---|---|
[MacOS] FileNotFoundError: [Errno 2] No such file or directory: 'xxxx.txt' (0) | 2022.09.28 |
[Python] Enumerate 함수 (0) | 2022.09.26 |
[Python] for문을 이용한 list 값 출력 (0) | 2022.09.26 |
[Python] Continue, Break (0) | 2022.09.26 |