Strings and Characters
This page provides syntax for different data types in Python as well as some of their associated functions. Each section includes an example to demonstrate the described syntax or function.
Strings
A string is a sequence of one or more characters (index values start at 0)
Some functions and index methods that can be performed on strings
Action | Function |
---|---|
get word length |
|
extract nth character from word |
|
extract substring nth-mth character from word |
|
search for character in word |
|
search for subword in word |
|
remove white spaces from the end of a word |
|
remove last character from word |
|
determine data structure type |
|
Input:
Output:
Resources
W3 Schools: Python Strings
Last updated