I have a python list as seen
base-list
['Year Built 2016', 'Floor 7', 'Year Built 2019', 'Floor 23', 'Year Built 2015', 'Floor 12', 'Year Built 2006', 'Floor 8', 'Year Built 2015', 'Floor 23', 'Year Built 2015', 'Floor 28', 'Year Built 2008', 'Floor 19', 'Year Built 2014', 'Floor 3', 'Year Built 2019', 'Floor 33', 'Year Built 1997', 'Floor 31', 'Year Built 2015', 'Floor 17', 'Year Built 2015', 'Floor 33', 'Year Built 1996', 'Floor 8', 'Year Built 2009', 'Floor 3', 'Year Built 2008', 'Floor 13', 'Year Built 2006', 'Floor 30', 'Year Built 2018', 'Floor 2', 'Year Built 2008', 'Floor 34', 'Year Built 2019', 'Floor 23', 'Year Built 2022', 'Floor 31', 'Year Built 2006', 'Floor 14', 'Year Built 2021', 'Floor 7', 'Year Built 2015', 'Floor 36', 'Year Built 2015', 'Floor 10', 'Year Built 2015', 'Floor 32', 'Year Built 2015', 'Floor 26', 'Year Built 2019', 'Floor 40', 'Year Built 2015', 'Floor 8', 'Year Built 2015', 'Floor 6']
from this list I wish to make new 2 seperate list. one for only ‘Year built’ and one for only ‘Floor’. anyone can give me advince on how to do this?
I have try this method
year_built_list = [i for i in base_list if base_list[i].startwith(‘Y’)]
*year_built_list is the new list I tried to create
but it’s not working
New contributor
Reaper Furry is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.