当前位置: 首页>>代码示例>>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;未经允许,请勿转载。