Coursera - Python Data Structures

From MyWiki
Revision as of 17:02, 19 November 2015 by George2 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

String slicing : a[start:end] # items start through end-1
a[start:] # items start through the rest of the array
a[:end] # items from the beginning through end-1
a[:] # a copy of the whole array

String find

#!/usr/bin/python
 
str1 = "this is string example....wow!!!";
str2 = "exam";
 
print str1.find(str2)
print str1.find(str2, 10)
print str1.find(str2, 40)