Skip to content

Instantly share code, notes, and snippets.

@goyalrohit
Created September 21, 2019 10:04
Show Gist options
  • Save goyalrohit/27e1c8752595e9e44639701c9870c5e7 to your computer and use it in GitHub Desktop.
Save goyalrohit/27e1c8752595e9e44639701c9870c5e7 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# Assing a value to a string with unwanted characters
str = ' Ok Let us learn about strip function in Python Ok';
# Prints the original value of the string
print str
# Prints the striped value of the string after removing leading and trailing word 'Ok'
print str.strip(' Ok')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment