cmd2.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:minihydra 作者: VillanCh 项目源码 文件源码
def pseudo_raw_input(self, prompt):
        """copied from cmd's cmdloop; like raw_input, but accounts for changed stdin, stdout"""

        if self.use_rawinput:
            try:
                line = sm.input(prompt)
            except EOFError:
                line = 'EOF'
        else:
            self.stdout.write(prompt)
            self.stdout.flush()
            line = self.stdin.readline()
            if not len(line):
                line = 'EOF'
            else:
                if line[-1] == '\n':  # this was always true in Cmd
                    line = line[:-1]
        return line
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号