String functions in Python Python Tutorial ,
HTML-код
- Опубликовано: 21 ноя 2024
- len() Returns the given string
title Returns the string with first letter of every word in the string in uppercase and rest in lowercase
lower() Returns the string with all uppercase letters converted to lowercase
upper() Returns the string with all lowercase letters converted to uppercase
count(str, start, end) Returns number of times substring str occurs in the given string. If we do not give start index and end index then searching starts from index 0 and ends at length of the string
find(str,start, Returns the first occurrence of end) index of substring str occurring in the given string. If we do not give start and end then searching starts from index 0 and ends at length of the string. If the
substring is not present in the given string, then the function returns -1
index(str, start, end) Same as find() but raises an exception if the substring is not present in the given string
endswith() Returns True if the given string ends with the supplied substring otherwise returns False
startswith() Returns True if the given string starts with the supplied substring otherwise returns False.
isalnum() Returns True if characters of the given string are either alphabets or numeric. If whitespace or special symbols are part of the given string or the string is empty it returns False
islower() Returns True if the string is non-empty and has all lowercase alphabets, or has at least one character as lowercase alphabet and rest are non-alphabet characters
isupper() Returns True if the string is non-empty and has all uppercase alphabets, or has at least one character as uppercase character and rest are non-alphabet characters
isupper() Returns True if the string is non-empty and has all uppercase alphabets, or has at least one character as uppercase character and rest are non-alphabet characters.
isspace() Returns True if the string is non-empty and all characters are white spaces (blank, tab, newline, carriage return)
istitle() Returns True if the string is non-empty and title case, i.e., the first letter of every word in the string in uppercase and rest in lowercase
lstrip() Returns the string after removing the spaces only on the left of the string
rstrip() Returns the string after removing the spaces only on the right of the string
strip() Returns the string after removing the spaces both on the left and the right of the string
replace(oldstr, newstr) Replaces all occurrences of old string with the new string
Built-in Modules
Other video of the Python Tutorial
Chapter 5 Video 1 - • Video
Chapter 5 Video 2 - • Video
Chapter 6 Video 3 - • Video
Star Pattern-1 - • Video
Fibo Checking - • Video
Palindrome Program - • Video
number pattern - • Video
Other series you may like
C language Series - • Video
SQL Language Series - • Type of SQL keys #SQL ...
Data Structure Series - • Video
Do like and subscribe our channel in case its useful for you, also share it to your friends.