Find knowledge base article(s) by searching for keywords in the title e.g. type linux in the search box below
Find knowledge base article(s) by browsing the subject categories of articles
Technology quick references, cheatsheets, user manuals etc.
Shop Online through ShopifyLite
Tutorials on various IT applications.
Search Title    (UL:0 |SS:f)

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[:]

 

[ © 2008-2021 myfaqbase.com - A property of WPDC Consulting ]