本文整理匯總了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)