Skip to content

Instantly share code, notes, and snippets.

@jorgenschaefer
Created March 28, 2014 16:56
Show Gist options
  • Save jorgenschaefer/9837551 to your computer and use it in GitHub Desktop.
Save jorgenschaefer/9837551 to your computer and use it in GitHub Desktop.
m = re.match(r'^(?:\s*([0-9]+)\s*x\s+)?(.*)$', line)
if m is None:
continue
quantity, typename = m.groups()
if quantity is None:
quantity = 1
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment