Skip to content

Instantly share code, notes, and snippets.

@sinebeef
Last active December 3, 2019 18:03
Show Gist options
  • Save sinebeef/3233ec0312985b680f3707d5bff75c2f to your computer and use it in GitHub Desktop.
Save sinebeef/3233ec0312985b680f3707d5bff75c2f to your computer and use it in GitHub Desktop.
A python 3 cheat sheet, because my brain is like a sieve
# merge list
string = "I said a hib hubbit"
list = []
list.extend(string.split())
# replace with diction key values:
inch_to_mm = {
'3/8"' : '10mm',
'1/2"' : '12mm',
'5/16"': '8mm',
'1/4"' : '6mm'
}
for k, v in inch_to_mm.items():
product_name = product_name.replace(k, v)
product_variation = product_variation.replace(k, v)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment