0% found this document useful (0 votes)
2 views2 pages

Python String Methods Selected

The document lists selected Python string methods along with their descriptions. Each method serves a specific function, such as converting case, checking character types, or manipulating string content. This serves as a quick reference for Python developers to utilize string methods effectively.

Uploaded by

monikacr396
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Python String Methods Selected

The document lists selected Python string methods along with their descriptions. Each method serves a specific function, such as converting case, checking character types, or manipulating string content. This serves as a quick reference for Python developers to utilize string methods effectively.

Uploaded by

monikacr396
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Selected Python String Methods

Sl Method Description

1 capitalize Converts first character to uppercase

2 count Counts occurrences of a substring

3 endswith Checks if string ends with the specified suffix

4 find Finds the first occurrence of substring, returns -1 if not found

5 index Like find() but raises ValueError if not found

6 isalnum Returns True if all characters are alphanumeric

7 isalpha Returns True if all characters are alphabetic

8 isascii Returns True if all characters are ASCII (Python 3.7+)

9 isdecimal Returns True if all characters are decimal digits

10 isdigit Returns True if all characters are digits

11 isidentifier Returns True if string is a valid Python identifier

12 islower Returns True if all cased characters are lowercase

13 isspace Returns True if all characters are whitespace

14 istitle Returns True if string is title cased

15 isupper Returns True if all cased characters are uppercase

16 lower Converts all characters to lowercase

17 lstrip Removes leading characters (default is whitespace)

18 replace Replaces all or limited occurrences of old with new

19 rindex Finds last occurrence of substring, raises ValueError if not found

20 rstrip Removes trailing characters (default is whitespace)

21 split Splits string into a list

22 splitlines Splits string at line breaks

23 startswith Checks if string starts with the specified prefix


24 strip Removes leading and trailing characters (default is whitespace)

25 swapcase Swaps case of all characters

26 title Converts string to title case

27 upper Converts all characters to uppercase

You might also like