Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图寻找答案,但我找不到。
我有两个清单。两个列表都有71 项。
我希望合并两个列表中的每个索引。
你可以这样做:
extensions =['.sp1', '.sp1', '.sp2'] my_numbers =[4, 16, 128] new_list = [] for x in range(len(my_numbers)): new_list.append("".join([str(my_numbers[x]), extensions[x]])) print(new_list)
输出:
['4.sp1', '16.sp1', '128.sp2']