Posted on September 11, 2020

Some basic examples of creating strings in Python.

# create a string with single quotes or double quotes
s1 = 'hello'
s2 = "hello there"

# use \ to escape a single quote or use double quotes
s3 = 'that ain\'t the one'
s4 = "that ain't the one"

Further reading


Gavin Wiggins © 2020