Skip to content

Instantly share code, notes, and snippets.

@PrateekKumarSingh
Created October 9, 2018 18:47
Show Gist options
  • Save PrateekKumarSingh/55a9bc973c9f6e30a540b2d2610f2df8 to your computer and use it in GitHub Desktop.
Save PrateekKumarSingh/55a9bc973c9f6e30a540b2d2610f2df8 to your computer and use it in GitHub Desktop.
# substring\slicing as a character array using range ':' operator
string = "My name is Prateek Singh\nI\'m from India"
# slicing the string from a specific index to another
string[11:18] # output: Prateek
string[11:24] # output: Prateek Singh
# slicing up to last index
string[25:] # output: I'm f rom India
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment