"); salt=raw_input("Salt-6ren">
gpt4 book ai didi

python - 扫描字符串文字时出现 SyntaxError EOL

转载 作者:太空宇宙 更新时间:2023-11-03 17:08:12 25 4
gpt4 key购买 nike

我正在尝试使用这个Python单行脚本:

python -c 'import hashlib,hmac; hash=raw_input("Hash > "); salt=raw_input("Salt > "); print "HMAC",hmac.new(salt,hash,hashlib.sha1).hexdigest().upper()'

它给了我这个错误:

File "<string>", line 1
'import
^
SyntaxError: EOL while scanning string literal

我使用的是 Windows 10 64 位,并且正在使用 ConEmu。

最佳答案

您可以在 Python 中使用单引号或双引号,但在命令行终端(cmd 或 Powershell)中,您必须使用双引号将要发送的参数括起来。用双引号将其括起来,并在其中使用单引号:

python -c "import hashlib,hmac; hash=raw_input('Hash > '); salt=raw_input('Salt > '); print 'HMAC',hmac.new(salt,hash,hashlib.sha1).hexdigest().upper()"

关于python - 扫描字符串文字时出现 SyntaxError EOL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34379631/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com