Created
September 12, 2009 11:49
-
-
Save NV/185809 to your computer and use it in GitHub Desktop.
Why result cannot be accessed like array?
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
| result = re.search(r"#[a-f0-9]{3}", 'Roses are #f00') | |
| result.group(0) == '#f00' # True | |
| result[0] # Damn! TypeError: '_sre.SRE_Match' object is unsubscriptable | |
| # Why result cannot be accessed like array? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment