【发布时间】:2018-07-02 21:19:58
【问题描述】:
lista = ['Add', 'Append']
listb = []
listc = []
listd = ['Delete']
liste = []
listf = []
listg = []
listh = []
listi = []
listj = []
listk = []
listl = []
listm = []
listn = []
listo = []
listp = []
listq = []
listr = []
lists = []
listt = []
listu = []
listv = []
listw = []
listx = []
listy = []
listz = []
listabc123 = lista + listb + listc + listd + liste + listf + listg + listh + listi + listj # <---All this is on same line as listabc123
listabc123 = listabc123 + listk + listl + listm + listn + listo + listp + listq + listr # <---All this is on same line as listabc123
listabc123 = listabc123 + lists + listt + listu + listv + listw + listx + listy + listz # <---All this is on same line as listabc123
在我写上面显示的最后一次尝试之前,我尝试对每个 lin 使用 \ 并在我想要合并的所有列表周围使用 ()。
运行时需要很长时间(我在空闲时按 Enter 之前等待的时间从未超过 5 分钟)然后我收到此错误。
runcode() 中的 IDLE 内部错误 回溯(最近一次通话最后): 文件“...\AppData\Local\Programs\Python\Python37-32\lib\idlelib\rpc.py”,第 339 行,在 putmessage r, w, x = select.select([], [self.sock], []) TypeError: 参数必须是 int,或者有 fileno() 方法。
在处理上述异常的过程中,又发生了一个异常:
Traceback(最近一次调用最后一次): 文件“...\AppData\Local\Programs\Python\Python37-32\lib\idlelib\rpc.py”,第 240 行,在异步队列中 self.putmessage((seq, request)) 文件“...\AppData\Local\Programs\Python\Python37-32\lib\idlelib\rpc.py”,第 342 行,在 putmessage 中 raise OSError("socket 不再存在") OSError: 套接字不再存在
感谢您抽出宝贵时间阅读并感谢您提供的任何帮助。提前致谢。
PS 使用 python 3.7
【问题讨论】:
-
你为什么要这样做?你想做什么?您的错误也与您发布的代码完全无关。
-
首先,您提到的错误不是您提供的代码。其次,你为什么有这么多清单?这方面有很多需要改进的地方,但我没有看到代码中有任何错误
-
多行列表合并?请...至少使用 for 循环来遍历列表并将它们组合起来。
-
我想最终将程序的命令放入列表中。然后在列表中为每个命令加上一个数字,以便我可以执行每个命令。
-
为什么有这么多列表,只是因为,我想让它保持井井有条。 lista 中的所有 A 命令等等。