我有一段代码,如下:
ascii_key = [None]*(len(ascii_username) + len(ascii_password))
ascii_key[0::2] = ascii_username
ascii_key[1::2] = ascii_password
我一直遇到以下错误:
ValueError:尝试将大小为8的序列分配给大小为6的扩展片
我认为这与我要准确地填写整个扩展列表有关,如果是这种情况,我有办法在生气之前将两个列表合并吗?
理想的过程是列表["A", "B", "C"]
和["D", "E", "F"]
成为
["A", "D", "B", "E", "C", "F"]
我尝试遵循此帖子Pythonic way to combine two lists in an alternating fashion?的解决方案>
-抱歉,我是新手程序员。
我有一段代码,如下:ascii_key = [无] *(len(ascii_username)+ len(ascii_password))ascii_key [0 :: 2] = ascii_username ascii_key [1 :: 2] = ascii_password以下...