简体   繁体   English

Python脚本不会在Windows命令行中输出

[英]Python script will not output in windows command line

I'm new to Python, using 2.7.12 and am trying to run a very simple script that will hash a 'salt' and simple password using a DES algorithm (I know DES is outdated but this is just to learn how to generate a hash value with a salt). 我是使用Python 2.7.12的新手,并且正在尝试运行一个非常简单的脚本,该脚本将使用DES算法对“盐”和简单密码进行哈希处理(我知道DES已过时,但这只是为了学习如何生成密码带有盐的哈希值)。 I have this working in the interpreter (ie I get the expected hash output 'HX9LLTdc/jiDE') but when I try to run it in my sublime text and/or via command line I get no errors but no output either? 我已经在解释器中运行了此程序(即,我得到了预期的哈希输出'HX9LLTdc / jiDE'),但是当我尝试在崇高的文本中和/或通过命令行运行它时,没有错误但也没有输出吗? I know this is a simple fix but i'm having a blank as to why its not outputting the hash value in my command line after running the script? 我知道这是一个简单的修复程序,但是我在运行脚本后为何不在命令行中输出哈希值的问题空白? Any advice, much appreciated. 任何建议,不胜感激。

import passlib.hash

def createHash():

    salt = "HX"
    word = "egg"
    cryptWord = passlib.hash.des_crypt.encrypt(word, salt=salt) 
    print "DES:" + cryptWord

You have to call the createHash() method: 您必须调用createHash()方法:

if __name__ == "__main__":
    createHash()

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

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