Title: String Indexing
Slug: string_indexing
Summary: String Indexing
Date: 2016-05-01 12:00
Category: Python
Tags: Basics
Authors: Chris Albon
In [1]:
string = 'Strings are defined as ordered collections of characters.'
In [2]:
string[:]
Out[2]:
In [3]:
string[0:3]
Out[3]:
In [4]:
string[:3]
Out[4]:
In [5]:
string[-3:]
Out[5]:
In [6]:
string[2:5]
Out[6]:
In [7]:
string[0:10:2]
Out[7]:
In [8]:
string[::-1]
Out[8]: