Created
May 29, 2015 09:32
-
-
Save Yagisanatode/6564668285670d0839e7 to your computer and use it in GitHub Desktop.
Python - Finding an Item Between Two Characters In a String Using: partition and rpartition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Finding an Item Between Two Characters In a String Using: | |
partition and rpartition | |
This could be handy for file creation and checking. | |
''' | |
file = 'batman(0).jpg' | |
file.partition('(')[-1].rpartition(')')[0] | |
''' | |
RESULT: | |
'0' | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment