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

Python String Functions

This document provides a comprehensive guide to commonly used Python string functions, each accompanied by a brief explanation of its purpose. Functions include methods for manipulating string cases, formatting, searching, and modifying strings. The guide serves as a quick reference for developers working with string operations in Python.
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 Functions

This document provides a comprehensive guide to commonly used Python string functions, each accompanied by a brief explanation of its purpose. Functions include methods for manipulating string cases, formatting, searching, and modifying strings. The guide serves as a quick reference for developers working with string operations in Python.
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

Python String Functions - Complete Guide

This document contains commonly used Python string functions (methods) with short explanations.

• capitalize() – Capitalizes first character

• casefold() – Converts string to lowercase (stronger than lower)

• center(width) – Centers string

• count() – Counts occurrences

• encode() – Encodes string

• endswith() – Checks ending

• expandtabs() – Expands tab spaces

• find() – Finds position

• format() – Formats string

• format_map() – Formats using mapping

• index() – Finds position (error if not found)

• isalnum() – Checks alphanumeric

• isalpha() – Checks alphabet

• isascii() – Checks ASCII characters

• isdecimal() – Checks decimal

• isdigit() – Checks digits

• isidentifier() – Checks valid identifier

• islower() – Checks lowercase

• isnumeric() – Checks numeric

• isprintable() – Checks printable

• isspace() – Checks whitespace

• istitle() – Checks title case

• isupper() – Checks uppercase

• join() – Joins iterable

• ljust() – Left justify

• lower() – Converts to lowercase

• lstrip() – Removes left spaces

• maketrans() – Creates translation table

• partition() – Splits into 3 parts

• removeprefix() – Removes prefix

• removesuffix() – Removes suffix

• replace() – Replaces substring

• rfind() – Finds from right

• rindex() – Finds from right (error if not found)


• rjust() – Right justify

• rpartition() – Splits from right

• rsplit() – Splits from right

• rstrip() – Removes right spaces

• split() – Splits string

• splitlines() – Splits lines

• startswith() – Checks starting

• strip() – Removes spaces both sides

• swapcase() – Swaps case

• title() – Title case

• upper() – Converts to uppercase

• zfill() – Pads with zeros

You might also like