You just need to index the string, just like you do with a list.
>>> 'hello'[3]
l
Note that Python indices (like most other languages) are zero based, so the first element is index 0, the second is index 1, etc.
For example:
>>> 'hello'[0]
h
>>> 'hello'[1]
e
Answer from Volatility on Stack OverflowW3Schools
w3schools.com › python › ref_string_index.asp
Python String index() Method
Remove List Duplicates Reverse ... Q&A Python Bootcamp Python Certificate Python Training ... The index() method finds the first occurrence of the specified value....
DigitalOcean
digitalocean.com › community › tutorials › how-to-index-and-slice-strings-in-python-3
How To Index and Slice Strings in Python | DigitalOcean
September 29, 2025 - For the string Sammy Shark! the index breakdown is like this: Character: S | a | m | m | y | | S | h | a | r | k | ! Positive: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 Negative: -12 | -11| -10| -9 | -8 | -7| -6 | -5 | -4 | -3 | -2 | -1 ... The fact that each character in a Python string has a corresponding index number allows us to access and manipulate strings in the same ways we can with other sequential data types.
Videos
07:28
String indexing in Python is easy ✂️ - YouTube
07:23
Python for Beginners — Part 25: String Indexing - YouTube
Python String Indexing - YouTube
09:16
Python for Beginners: Part 4 (String Indexing and Slicing) - YouTube
15:29
18. Mastering Python Indexing and Slicing | Python Tutorial - YouTube
05:06
String Indexing in Python - How to Get a Character from a String ...
Programiz
programiz.com › python-programming › methods › string › index
Python String index()
Become a certified Python programmer. Try Programiz PRO! ... The index() method returns the index of a substring inside the string (if found).
CodeHS
codehs.com › tutorial › 13725
Tutorial: Indexing Python Strings | CodeHS
Click on one of our programs below to get started coding in the sandbox! ... Learn how to access specific items by indexing through Python strings.
Top answer 1 of 3
4
You just need to index the string, just like you do with a list.
>>> 'hello'[3]
l
Note that Python indices (like most other languages) are zero based, so the first element is index 0, the second is index 1, etc.
For example:
>>> 'hello'[0]
h
>>> 'hello'[1]
e
2 of 3
1
its just straight forward.
str[any subscript]. //e.g. str[0], str[0][0]
Codecademy
codecademy.com › learn › dacp-python-fundamentals › modules › dscp-python-strings › cheatsheet
Python Fundamentals: Python Strings Cheatsheet | Codecademy
In Python, the built-in len() function can be used to determine the length of an object. It can be used to compute the length of strings, lists, sets, and other countable objects.
Tutorialspoint
tutorialspoint.com › python › string_index.htm
Python String index() Method
The python string index() method is used to return the index of the input string where the substring is found. Basically, it helps us to find out if the specified substring is present in the input string.
Codecademy
codecademy.com › docs › python › strings › .index()
Python | Strings | .index() | Codecademy
November 1, 2021 - The .index() string method searches through a string variable for the occurrence of a pattern or a substring. If the substring is not found, a ValueError will be raised. ... Looking for an introduction to the theory behind programming?
UC Berkeley Statistics
stat.berkeley.edu › ~spector › extension › python › notes › node19.html
Indexing and Slicing
To extract a single character from a string, follow the string with the index of the desired character surrounded by square brackets ([ ]), remembering that the first character of a string has index zero. >>> what = 'This parrot is dead' >>> what[3] 's' >>> what[0] 'T' If the subscript you ...
Runestone Academy
runestone.academy › ns › books › published › thinkcspy › Strings › IndexOperatorWorkingwiththeCharactersofaString.html
9.4. Index Operator: Working with the Characters of a String — How to Think like a Computer Scientist: Interactive Edition
The indexing operator (Python uses square brackets to enclose the index) selects a single character from a string. The characters are accessed by their position or index value. For example, in the string shown below, the 14 characters are indexed left to right from postion 0 to position 13.
O'Reilly
oreilly.com › library › view › learn-programming-in › 9781789531947 › 6f7c08e0-e72b-402b-86fe-843ac3a8aa7e.xhtml
Indexing and slicing strings - Learn Programming in Python with Cody Jackson [Book]
November 29, 2018 - Indexing and slicing strings Python strings functionally operate the same as Python lists, which are basically C arrays (see the Lists section). Unlike C arrays, characters within... - Selection from Learn Programming in Python with Cody Jackson [Book]
Author Cody Jackson
Published 2018
Pages 304
Real Python
realpython.com › videos › string-indexing
String Indexing (Video) – Real Python
Indexing allows you to access individual characters in a string directly by using a numeric value. String indexing is zero-based: the first character in the string has index 0, the next is 1, and so on.
Published October 1, 2019
PythonForBeginners
pythonforbeginners.com › home › string indexing in python
String Indexing in Python - PythonForBeginners.com
January 9, 2022 - If we have an ordered sequence ... Indexing, we can access any element from an ordered sequence using the indices. In python, string indexing is zero based....
Tu-delft-dcc
tu-delft-dcc.github.io › Intro-to-Python-for-GIS › Instructor_notes › Day_1 › lesson_notes › B2_Vars_Types.html
Use an index to get a single character from a string. — Python essentials for GIS learners
We take a slice by using [start:stop], where start is replaced with the index of the first element we want and stop is replaced with the index of the element just after the last element we want. Mathematically, you might say that a slice selects [start:stop). The difference between stop and start is the slice’s length. Taking a slice does not change the contents of the original string. Instead, the slice is a copy of part of the original string. ... Nested functions are evaluated from the inside out, like in mathematics. Python thinks that upper- and lower-case letters are different, so Name and name are different variables.
Pythonspot
pythonspot.com › string-index
python string index - Python Tutorial
Python hosting: Host, run, and code Python in the cloud! The function .index() returns the index (position) of a substring in a string (if found). Returns exception if not found. It’s case sensitive.
Top answer 1 of 4
15
In python3 range is an generator, and not a list. That means that the following code will not require excessive memory:
for i in range(start_pos, len(my_string)):
print(my_string[i])
If you'd rather use an iterator over my_string then you need to write it yourself:
def iter_starting_at(start_pos, string):
for i in range(start_pos, len(string)):
yield string[i]
for character in iter_starting_at(start_pos, my_string):
print(character)
2 of 4
4
you can do it using string indexes, like it's list:
for i in xrange(100, 200):
print(s[i])