Last active
December 3, 2019 18:03
-
-
Save sinebeef/3233ec0312985b680f3707d5bff75c2f to your computer and use it in GitHub Desktop.
A python 3 cheat sheet, because my brain is like a sieve
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
# 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