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
评论列表
文章目录