Skip to content

hcvazquez/python-string-manipulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

python-string-manipulation

Python has quite a few methods that string objects can call to perform frequency occurring task (related to string). For example, if you want to capitalize the first letter of a string, you can use capitalize() method.

The page contains all methods of string objects. Also, the page includes built-in functions that can take string as a parameter and perform some task. For example, len() method returns the length of the string passed as a parameter to this function.

Method Description
capitalize() Converts first character to Capital Letter
center() Pads string with specified character
casefold() converts to casefolded strings
count() returns occurrences of substring in string
endswith() Checks if String Ends with the Specified Suffix
expandtabs() Replaces Tab character With Spaces
encode() returns encoded string of given string
find() Returns the index of first occurrence of substring
format() formats string into nicer output
index() Returns Index of Substring
isalnum() Checks Alphanumeric Character
isalpha() Checks if All Characters are Alphabets
isdecimal() Checks Decimal Characters
isdigit() Checks Digit Characters
isidentifier() Checks for Valid Identifier
islower() Checks if all Alphabets in a String are Lowercase
isnumeric() Checks Numeric Characters
isprintable() Checks Printable Character
isspace() Checks Whitespace Characters
istitle() Checks for Titlecased String
isupper() returns if all characters are uppercase characters
join() Returns a Concatenated String
ljust() returns left-justified string of given width
rjust() returns right-justified string of given width
lower() returns lowercased string
upper() returns uppercased string
swapcase() swap uppercase characters to lowercase; vice versa
lstrip() Removes Leading Characters
rstrip() Removes Trailing Characters
strip() Removes Both Leading and Trailing Characters
partition() Returns a Tuple
maketrans() returns a translation table
rpartition() Returns a Tuple
translate() returns mapped charactered string
replace() Replaces Substring Inside
rfind() Returns the Highest Index of Substring
rindex() Returns Highest Index of Substring
split() Splits String from Left
rsplit() Splits String From Right
splitlines() Splits String at Line Boundaries
startswith() Checks if String Starts with the Specified String
title() Returns a Title Cased String
zfill() Returns a Copy of The String Padded With Zeros
format_map() Formats the String Using Dictionary
any() Checks if any Element of an Iterable is True
all() returns true when all elements in iterable is true
ascii() Returns String Containing Printable Representation
bool() Converts a Value to Boolean
bytearray() returns array of given byte size
bytes() returns immutable bytes object
compile() Returns a
complex() Creates a Complex Number
enumerate() Returns an Enumerate Object
filter() constructs iterator from elements which are true
float() returns floating point number from number, string
input() reads and returns a line of string
int() returns integer from a number or string
iter() returns iterator for an object
len() Returns Length of an Object
max() returns largest element
min() returns smallest element
map() Applies Function and Returns a List
ord() returns Unicode code point for Unicode character
reversed() returns reversed iterator of a sequence
slice() creates a slice object specified by range()
sorted() returns sorted list from a given iterable
sum() Add items of an Iterable
zip() Returns an Iterator of Tuples

Releases

No releases published

Packages

No packages published