Skip to content

Instantly share code, notes, and snippets.

@tlehman
Created August 17, 2012 00:39
Show Gist options
  • Select an option

  • Save tlehman/3374813 to your computer and use it in GitHub Desktop.

Select an option

Save tlehman/3374813 to your computer and use it in GitHub Desktop.
convert in to mm in triples
def mm(s):
in_to_mm = lambda i: i*25.4
delim = " x "
ss = s.replace(" ", "").lower().split(delim.replace(" ", ""))
dims_in = map(float, ss)
dims_mm = map(in_to_mm, dims_in)
return reduce(lambda l,r: l+delim+r, map(str, dims_mm),"")[len(delim):-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment