本文整理汇总了Python中msvcrt.putwch方法的典型用法代码示例。如果您正苦于以下问题:Python msvcrt.putwch方法的具体用法?Python msvcrt.putwch怎么用?Python msvcrt.putwch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msvcrt
的用法示例。
在下文中一共展示了msvcrt.putwch方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: win_getpass
# 需要导入模块: import msvcrt [as 别名]
# 或者: from msvcrt import putwch [as 别名]
def win_getpass(prompt='Password: ', stream=None):
"""Prompt for password with echo off, using Windows getch()."""
if sys.stdin is not sys.__stdin__:
return fallback_getpass(prompt, stream)
for c in prompt:
msvcrt.putwch(c)
pw = ""
while 1:
c = msvcrt.getwch()
if c == '\r' or c == '\n':
break
if c == '\003':
raise KeyboardInterrupt
if c == '\b':
pw = pw[:-1]
else:
pw = pw + c
msvcrt.putwch('\r')
msvcrt.putwch('\n')
return pw
示例2: win_getpass
# 需要导入模块: import msvcrt [as 别名]
# 或者: from msvcrt import putwch [as 别名]
def win_getpass(prompt='Password: ', stream=None):
"""Prompt for password with echo off, using Windows getch()."""
if sys.stdin is not sys.__stdin__:
return fallback_getpass(prompt, stream)
import msvcrt
for c in prompt:
msvcrt.putwch(c)
pw = ""
while 1:
c = msvcrt.getwch()
if c == '\r' or c == '\n':
break
if c == '\003':
raise KeyboardInterrupt
if c == '\b':
pw = pw[:-1]
else:
pw = pw + c
msvcrt.putwch('\r')
msvcrt.putwch('\n')
return pw
示例3: __ichr
# 需要导入模块: import msvcrt [as 别名]
# 或者: from msvcrt import putwch [as 别名]
def __ichr(self):
addr = self.__stck.pop()
# Input Routine
while msvcrt.kbhit():
msvcrt.getwch()
while True:
char = msvcrt.getwch()
if char in '\x00\xE0':
msvcrt.getwch()
elif char in string.printable:
char = char.replace('\r', '\n')
msvcrt.putwch(char)
break
item = ord(char)
# Storing Number
self.__heap.set_(addr, item)
示例4: __oint
# 需要导入模块: import msvcrt [as 别名]
# 或者: from msvcrt import putwch [as 别名]
def __oint(self):
for digit in str(self.__stck.pop()):
msvcrt.putwch(digit)
示例5: __iint
# 需要导入模块: import msvcrt [as 别名]
# 或者: from msvcrt import putwch [as 别名]
def __iint(self):
addr = self.__stck.pop()
# Input Routine
while msvcrt.kbhit():
msvcrt.getwch()
buff = ''
char = msvcrt.getwch()
while char != '\r' or not buff or len(buff) == 1 and buff in '+-':
if char in '\x00\xE0':
msvcrt.getwch()
elif char in '+-' and not buff:
msvcrt.putwch(char)
buff += char
elif '0' <= char <= '9':
msvcrt.putwch(char)
buff += char
elif char == '\b':
if buff:
buff = buff[:-1]
msvcrt.putwch(char)
msvcrt.putwch(' ')
msvcrt.putwch(char)
char = msvcrt.getwch()
msvcrt.putwch(char)
msvcrt.putwch('\n')
item = int(buff)
# Storing Number
self.__heap.set_(addr, item)
示例6: __ochr
# 需要导入模块: import msvcrt [as 别名]
# 或者: from msvcrt import putwch [as 别名]
def __ochr(self):
for c in repr(chr(self.__stck.pop())):
msvcrt.putwch(c)