String Slice : String Slice : String : Python examples (example source code) Organized by topic

C++
PHP
Python
Python Home »  String   » [  String Slice  ]  Screenshots 
 



String Slice




begin = 2
end   = 5
word="a long word"

print "word[", begin, ":", end, "]\t\t",
print word[begin:end]

           
       
Related examples in the same category
1.  String slicing: extrace section String slicing: extrace section
2.  Strings can be subscripted (indexed) Strings can be subscripted (indexed)
3.  An invariant of slice operations: s[:i] + s[i:] equals s An invariant of slice operations: s[:i] + s[i:] equals s
4.  Degenerate slice indices Degenerate slice indices
5.  Negative Indices numbers: start counting from the right Negative Indices numbers: start counting from the right
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.