我有两个列表。
d1 = ["'02/01/2018'", "'01/01/2018'", "'12/01/2017'"]
d2 = ["'02/28/2018'", "'01/31/2018'", "'12/31/2017'"]
我正在尝试在for循环中对这些值进行解压。
for i,y in d1,d2:
i,y = Startdate, Enddate
我知道这个迭代会在每个迭代中覆盖Startdate和Enddate的值,但现在我只是想成功地解包每个列表中的元素。
我收到以下错误:
too many values to unpack (expected 2)
我以为我正在解包两个变量(d1和d2)
for i, y in zip(d1, d2):
- Noumand1,d2
creates a tuple with two elements, your lists... each of your lists has three elements, which it tries to unpack intoi,y
- juanpa.arrivillaga