2 回答
TA贡献2041条经验 获得超4个赞
你可以这样做
my_list = ['10026','10067','10093','10117','10132','10133','10464','10524','10654','10657','10658','10701','10809','10966','11153','11173','11327','11453','11470','11478','11488','11490','12733','12750','12754','12785','13053','13683','13895','14347','14420','14438','14452','14453','14457','14460','14755','16913','17460','17497','17500','17502','18007','18013','18058','18265','18711','18778','18779','18782','18913','19790','20105','20363','20609','20766','20770','21212','21216','21262','21471','21520','21555','21833','21946','21961','22115','22203','22994','23457','23800','24260','24590','25155','25649','25749','26021','26022']
unspsc_links = [f"https://order.besse.com/Orders/Search/ProductSearch?query={i}" for i in my_list]
TA贡献1831条经验 获得超10个赞
由于您只有一个名为 的变量,unspsc_link因此对于循环的每次迭代,它都会被覆盖。相反,您可以使用生成的 URL 创建一个新列表:
myList = ['10026','10067','10093','10117','10132','10133','10464','10524','10654','10657','10658','10701','10809','10966','11153','11173','11327','11453','11470','11478','11488','11490','12733','12750','12754','12785','13053','13683','13895','14347','14420','14438','14452','14453','14457','14460','14755','16913','17460','17497','17500','17502','18007','18013','18058','18265','18711','18778','18779','18782','18913','19790','20105','20363','20609','20766','20770','21212','21216','21262','21471','21520','21555','21833','21946','21961','22115','22203','22994','23457','23800','24260','24590','25155','25649','25749','26021','26022']
unspsc_link = []
for i in myList:
unspsc_link.append(f"https://order.besse.com/Orders/Search/ProductSearch?query={i}")
这将生成一个包含所有所需 URL 的列表。
添加回答
举报