【发布时间】:2021-03-12 06:08:23
【问题描述】:
我有两个列表:
country_name = ['South Africa', 'India', 'United States']
country_code = ['ZA', 'IN', 'US']
我的目标是压缩并加入他们,以便获得以下列表:
countries = ['South Africa ZA', 'India IN', 'United States US']
【问题讨论】:
-
countries = [" ".join(tpl) for tpl in zip(country_name, country_code)]
标签: python list join merge zip