m0_57901298
2021-06-22 20:30
采纳率: 44.4%
浏览 71

ValueError: too many values to unpack (expected 2)

C:\Users\Administrator\AppData\Local\Programs\Python\Python38\PyCode\bomb>bomb.p
y 5 0.01 0 100 Hello!!!!!!!!!!!!!!!!!!!!!
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\PyCode\bom
b\bomb.py", line 36, in <module>
    for i, j in (args, names):
ValueError: too many values to unpack (expected 2)

import pyperclip as pc
import time
import pyautogui as pag
import sys

def _paste():
	return pag.hotkey('ctrl', 'c')

args = sys.argv[1:]
names = ['_wait', '_often', '_from', '_to', '_first']

class _Click(object):
	def __init__(self):
		self._wait = None
		self._often = None
		self._from = None
		self._to = None
		self._first = ''
	
	def _send(self, arg, value):
		return setattr(self, arg, value)
	
	def _click(self):
		time.sleep(int(self._wait))
		pc.copy(str(self._first))
		_paste()
		pag.press('enter')
		for i in range(self._from, self._to + 1, 1):
			pc.copy(str(i))
			_paste()
			pag.press('enter')
			time.sleep(self._often)

if __name__ == '__main__':
	c = _Click()
	for i, j in (args, names):
		c._send(j, i)
	
	c._click()
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • m0_57901298 2021-06-23 12:50
    已采纳

    已解决, for i, j in zip(args, names):

    正在修正其他Bug

    打赏 评论
  • 奋斗的小小鱼 2021-06-22 21:20
    for i, j in (args, names) 有问题,可以拆开写 for i in args 和for j in names
    打赏 评论

相关推荐 更多相似问题