Skip to content

Instantly share code, notes, and snippets.

@NV
Created September 12, 2009 11:49
Show Gist options
  • Select an option

  • Save NV/185809 to your computer and use it in GitHub Desktop.

Select an option

Save NV/185809 to your computer and use it in GitHub Desktop.
Why result cannot be accessed like array?
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