Skip to content

Instantly share code, notes, and snippets.

@Jayasagar
Created December 18, 2017 12:46
Show Gist options
  • Save Jayasagar/5b474440fbb0999998b79c79850102bf to your computer and use it in GitHub Desktop.
Save Jayasagar/5b474440fbb0999998b79c79850102bf to your computer and use it in GitHub Desktop.
# String examples
str = 'Python'
print str[0] ## P
print len(str) ## 6
print str + ' py' ## Python py
# String Slice
print str[2:4] ## th -> include index 2 and exclude index 4
print str[:] ## Python
# String % operator
formatText = "Decision from %d data rows is not enough to decide accurate value for feature %s" % (1000, 'Gender')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment