Strings
Can be enclosed in single or double quotes
a ='some text'
b = "some text"
print(type(a)) '<class 'str'>
Multi-Line
We can use three single quotes
myText = '''Some
Multi Line
Text'''
print(myText)
String Concatenation
Use the plus operator
str1 = "some"
str2 = "text"
result = str1 + str2
print(result[3]) ' positive indices from the left / start
print(result[-3]) ' negative indices from the right / end
str3 = '' ' empty string
Slicing
str = 'some text'
print(str[0:4])
The first character position is 0 and the length is 4
str = 'some text'
print(len(str))
SubString Exists
str = "better solutions"
print(str.split(' ')
print('better' in str)
Methods
capitalize
capwords
casefold
center
encode
endswith
expandtabs
find
format
format_map
index
isalnum
isascii
isdecimal
isdigit
isidentifier
islower
isnumeric
isprintable
isspace
istitle
isupper
len
lower
ljust
lstrip
maketrans
partition
removeprefix
removesuffix
replace
rfind
rindex
rjust
rpartition
rsplit
rstrip
split
splitlines
startswith
strip
swapcase
title
translate
upper
zfill
© 2025 Better Solutions Limited. All Rights Reserved. © 2025 Better Solutions Limited Top