简体   繁体   English

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

[英]SyntaxError EOL while scanning string literal

I'm trying to use this Python one liner script: 我正在尝试使用此Python一线脚本:

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

And it gives me this error: 它给了我这个错误:

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

I'm using Windows 10 64bit and I'm working with ConEmu. 我正在使用Windows 10 64位,并且正在使用ConEmu。

You can use single or double quotes within Python, but at the command-line terminal (cmd or Powershell) you have to use double quotes to enclose the argument you wish to send. 您可以在Python中使用单引号或双引号,但是在命令行终端(cmd或Powershell)中,您必须使用双引号将希望发送的参数括起来。 Enclose it with double quotes, and use single quotes within it: 用双引号将其括起来,并在其中使用单引号:

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

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM