Scripting >> Python >> Examples >> Strings >> How to slice strings

s = "hello world"

To get string slice starting from position 0 up to and before position 4

print s[0:4]
output: hell

To get string slice starting from position 6 up to and before position 7

print s[6,7]
output: w

To get the entire string

print s[:]