简体   繁体   English

Python ValueError:没有足够的值来解压(预期 3,得到 1)

[英]Python ValueError: not enough values to unpack (expected 3, got 1)

i tried writing this code but had an error.我尝试编写此代码,但出现错误。 used windows 10 and python 3.8.5使用 windows 10 和 python 3.8.5

#usage
#python3 coex.py combo.txt extracted.txt

from sys import argv
import re

script , combo_file , ex_file = argv

cfile = open(combo_file)
xfile = open(ex_file, 'w')
def rexmail(cfile):
    rexmail = re.compile(r'[a-zA-Z0-9_.+-]+@[a-zA-Z0-9.-]+:[a-zA-Z0-9._-]+')
    cfile = rexmail.findall(cfile.read())
    
    lenofclist = len(cfile)
    for i in range(lenofclist):
        xfile.write("\n")
        xfile.write(str(cfile[i]))
        
    print("[+]*********EXTRACTING DONE***********[+]\n")
    print("[+]*********CHECK extracted.txt FILE FOR EMAIL:PASS COMBOS*************[+]\n")




def header():
    print('''
            made with <3

 _______           ___    ___      _________        ________          ________          ________          _________        ________          ________     
|\  ___ \         |\  \  /  /|    |\___   ___\     |\   __  \        |\   __  \        |\   ____\        |\___   ___\     |\   __  \        |\   __  \    
\ \   __/|        \ \  \/  / /    \|___ \  \_|     \ \  \|\  \       \ \  \|\  \       \ \  \___|        \|___ \  \_|     \ \  \|\  \       \ \  \|\  \   
 \ \  \_|/__       \ \    / /          \ \  \       \ \   _  _\       \ \   __  \       \ \  \                \ \  \       \ \  \\\  \       \ \   _  _\  
  \ \  \_|\ \       /     \/            \ \  \       \ \  \\  \|       \ \  \ \  \       \ \  \____            \ \  \       \ \  \\\  \       \ \  \\  \| 
   \ \_______\     /  /\   \             \ \__\       \ \__\\ _\        \ \__\ \__\       \ \_______\           \ \__\       \ \_______\       \ \__\\ _\ 
    \|_______|    /__/ /\ __\             \|__|        \|__|\|__|        \|__|\|__|        \|_______|            \|__|        \|_______|        \|__|\|__|
                  |__|/ \|__|                                                                                                                             
                                                                                                       EMAIL:PASS extractor from any txt file .                                                   
                                                                                                                                                          

''')


header()

rexmail(cfile)

Error:错误:

Traceback (most recent call last):
  File "C:\Users\BRS\Desktop\minecraft\Combo-Extractor-master\coex.py", line 8, in <module>
    script , combo_file , ex_file = argv
ValueError: not enough values to unpack (expected 3, got 1)

I dont really get what's off.我真的不明白发生了什么。 please help me by correcting this code.请通过更正此代码来帮助我。 and if possible tell me why this happens如果可能的话,告诉我为什么会这样

is it a problem with tuples or what pls help with this这是元组的问题还是有什么帮助

argv actually return a list whose first element (ie index 0 element) is the location of the python file. argv实际上返回一个列表,其第一个元素(即索引 0 元素)是 python 文件的位置。 To correct this error, use script, combo_file, ex_file = argv[1:]要更正此错误,请使用script, combo_file, ex_file = argv[1:]
Alternatively, you can also use _, script, combo_file, ex_file = argv或者,您也可以使用_, script, combo_file, ex_file = argv

Relevant Documentation - https://docs.python.org/3/library/sys.html相关文档 - https://docs.python.org/3/library/sys.html

(Tested on Windows 10 (64 Bit) Python 3.7.4) (在 Windows 10(64 位)Python 3.7.4 上测试)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python 2-ValueError:没有足够的值可解包(预期6,得到1) - Python 2 - ValueError: not enough values to unpack (expected 6, got 1) Python:ValueError:没有足够的值来解包(预期为 3,得到 1) - Python: ValueError: not enough values to unpack (expected 3, got 1) Python ValueError:没有足够的值来解包(预期 3,得到 2) - Python ValueError: not enough values to unpack (expected 3, got 2) Python 3 - ValueError:没有足够的值来解包(预期 3,得到 2) - Python 3 - ValueError: not enough values to unpack (expected 3, got 2) python:ValueError:没有足够的值要解压(预期2,得到0) - python: ValueError: not enough values to unpack (expected 2, got 0) Python,ValueError:没有足够的值来解包(预期 2,得到 1) - Python, ValueError: not enough values to unpack (expected 2, got 1) Python ValueError:没有足够的值来解压(预期 2,得到 1) - Python ValueError: not enough values to unpack (expected 2, got 1) Python,ValueError:没有足够的值来解压(预期 2,得到 1),Python OOP - Python, ValueError: not enough values to unpack (expected 2, got 1), Python OOP ValueError:没有足够的值来解包(预期为 3,得到 2)-python/tensorflow - ValueError: not enough values to unpack (expected 3, got 2) - python/tensorflow Python 版本 3 - ValueError: 没有足够的值来解包(预期 2,得到 1) - Python Version 3 - ValueError: not enough values to unpack (expected 2, got 1)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM