當前位置: 首頁>>代碼示例>>Python>>正文


Python msvcrt.putwch方法代碼示例

本文整理匯總了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 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:23,代碼來源:getpass.py

示例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 
開發者ID:IronLanguages,項目名稱:ironpython3,代碼行數:23,代碼來源:getpass.py

示例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) 
開發者ID:ActiveState,項目名稱:code,代碼行數:18,代碼來源:recipe-577110.py

示例4: __oint

# 需要導入模塊: import msvcrt [as 別名]
# 或者: from msvcrt import putwch [as 別名]
def __oint(self):
        for digit in str(self.__stck.pop()):
            msvcrt.putwch(digit) 
開發者ID:ActiveState,項目名稱:code,代碼行數:5,代碼來源:recipe-577110.py

示例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) 
開發者ID:ActiveState,項目名稱:code,代碼行數:30,代碼來源:recipe-577110.py

示例6: __ochr

# 需要導入模塊: import msvcrt [as 別名]
# 或者: from msvcrt import putwch [as 別名]
def __ochr(self):
            for c in repr(chr(self.__stck.pop())):
                msvcrt.putwch(c) 
開發者ID:ActiveState,項目名稱:code,代碼行數:5,代碼來源:recipe-577110.py


注:本文中的msvcrt.putwch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。