Channi Studies

Analyzing String | 문자열 함수들 본문

python

Analyzing String | 문자열 함수들

Chan Lee 2025. 1. 12. 15:28

There are some ways in Python to analyze string. 

 

  • substring in s

Returns True if the string s contains substring and False otherwise.

if "-" is not in name:
	...
  • s.count(substring)

Returns the number of non-overlapping occurrences of substring in s.

  • s.endswith(substring)

Returns True if the string s ends with the substring and False otherwise.

  • s.startswith(substring)

Returns True if the string s starts with the substring and False otherwise.

  • s.find(substring)

Returns the lowest index in the string s where substring begins, or –1 if substring is not found.

 

'python' 카테고리의 다른 글

List 리스트  (0) 2025.01.26
Terminating a Program (프로그램 종료)  (0) 2025.01.12
[baekjoon] 2563번 색종이 Python  (0) 2023.10.14
[baekjoon] 10789번 세로읽기 Python  (1) 2023.10.14
[programmers] 문자열 여러번 뒤집기 (python)  (8) 2023.10.11