手机
当前位置:查字典教程网 >脚本专栏 >python >python实现在控制台输入密码不显示的方法
python实现在控制台输入密码不显示的方法
摘要:本文实例讲述了python实现在控制台输入密码不显示的方法。分享给大家供大家参考。具体实现方法如下:importconsole;namesp...

本文实例讲述了python实现在控制台输入密码不显示的方法。分享给大家供大家参考。具体实现方法如下:

import console; namespace console{ //控制台读取密码,并显示星号 getPassword = function(){ var tstr = {}; var input = kbRead(true); while( input.wVirtualKeyCode != 0xD/*_VK_ENTER*/ ){ if( input.uChar.asciiChar ){ ..table.push(tstr,input.uChar.asciiChar); if( input.uChar.asciiChar > 0x80){ ..table.push(tstr,kbRead(true).uChar.asciiChar); } ..io.stdout.write("*"); } input = kbRead(true); } ..io.stdout.write('n'); return ..string.pack(tstr); } } io.open(); io.stdout.write("请输入密码:"); var pwd = console.getPassword(); import win; win.msgbox(pwd,"密码");

希望本文所述对大家的Python程序设计有所帮助。

【python实现在控制台输入密码不显示的方法】相关文章:

python实现定制交互式命令行的方法

python实现目录树生成示例

Python批量修改文件后缀的方法

python控制台显示时钟的示例

python正则表达式修复网站文章字体不统一的解决方法

python实现dict版图遍历示例

Python去掉字符串中空格的方法

python实现的各种排序算法代码

Python实现扫描指定目录下的子目录及文件的方法

python实现监控linux性能及进程消耗性能的方法

精品推荐
分类导航