If your pattern always like you depict, you can split(': ')
your items
my_list = ['Location: NY', 'price: 11103 USD', 'Year: 2018', 'Model: Golf VII']
my_dict = { i.split(': ')[0] : i.split(': ')[1] for i in my_list }
ADDITION FOR THE EMPTY VALUES:
You can also extract your logic into a function and make some other controls (trimming, null values etc), and still use dictionary comprehension as follows:
def str_to_keyval(inp, separator=':'):
# to list
li = inp.split(separator) if (separator in inp) else [inp, '']
# strip elements
return [i.strip() for i in li]
my_list = [
'Location: NY',
'price: 11103 USD',
'Year: 2018',
'Model: Golf VII',
'Security',
'Airbag'
]
my_dict = { str_to_keyval(i)[0] : str_to_keyval(i)[1] for i in my_list }
You can change the presentation of null values (ignore their keys, or denote with an empty string etc.) through editing the first line of str_to_keyval
function in the example. As it is, it gives empty string as missing values.