Movatterモバイル変換


[0]ホーム

URL:


Up one LevelPython Library ReferenceContentsModule IndexIndex


27.1.2 Interactive Console Objects

TheInteractiveConsole class is a subclass ofInteractiveInterpreter, and so offers all the methods of theinterpreter objects as well as the following additions.

interact([banner])
Closely emulate the interactive Python console.The optional banner argument specify the banner to print before thefirst interaction; by default it prints a banner similar to the oneprinted by the standard Python interpreter, followed by the classname of the console object in parentheses (so as not to confuse thiswith the real interpreter - since it's so close!).

push(line)
Push a line of source text to the interpreter.The line should not have a trailing newline; it may have internalnewlines. The line is appended to a buffer and the interpreter'srunsource() method is called with the concatenated contentsof the buffer as source. If this indicates that the command wasexecuted or invalid, the buffer is reset; otherwise, the command isincomplete, and the buffer is left as it was after the line wasappended. The return value isTrue if more input is required,False if the line was dealt with in some way (this is the same asrunsource()).

resetbuffer()
Remove any unhandled source text from the input buffer.

raw_input([prompt])
Write a prompt and read a line. The returned line does not includethe trailing newline. When the user enters the EOF key sequence,EOFError is raised. The base implementation uses thebuilt-in functionraw_input(); a subclass may replace thiswith a different implementation.


Up one LevelPython Library ReferenceContentsModule IndexIndex

Release 2.5.2, documentation updated on 21st February, 2008.
SeeAbout this document... for information on suggesting changes.
[8]ページ先頭

©2009-2025 Movatter.jp