IOConsole

IOConsole()

A console input/output stream.

Static Methods

get_default

get_default() -> IOStream

Get the default input/output stream.
Returns:
IOStream: The default input/output stream.

Returns:
TypeDescription
IOStreamIOStream: The default input/output stream.

get_global_default

get_global_default() -> IOStream

Get the default input/output stream.
Returns:
IOStream: The default input/output stream.

Returns:
TypeDescription
IOStreamIOStream: The default input/output stream.

set_default

set_default(stream: ForwardRef('IOStream') | None) -> Iterator[None]

Set the default input/output stream.

Parameters:
NameDescription
streamThe input/output stream to set as the default.

Type: ForwardRef(‘IOStream’) | None

set_global_default

set_global_default(stream: IOStream) -> None

Set the default input/output stream.

Parameters:
NameDescription
streamThe input/output stream to set as the default.

Type: IOStream

Instance Methods

input

input(
    self,
    prompt: str = '',
    *,
    password: bool = False
) -> str

Read a line from the input stream.

Parameters:
NameDescription
promptThe prompt to display.

Defaults to "".

Type: str

Default:
passwordWhether to read a password.

Defaults to False.

Type: bool

Default: False
Returns:
TypeDescription
strstr: The line read from the input stream.

print

print(
    self,
    *objects: Any,
    sep: str = ' ',
    end: str = '\n',
    flush: bool = False
) -> None

Print data to the output stream.

Parameters:
NameDescription
*objectsType: Any
sepThe separator between objects.

Defaults to ” ”.

Type: str

Default: ’ ‘
endThe end of the output.

Defaults to “

Type: str

Default: ‘\n’
flushWhether to flush the output.

Defaults to False.

Type: bool

Default: False

send

send(self, message: BaseMessage) -> None

Send a message to the output stream.

Parameters:
NameDescription
messageThe message to send.

Type: BaseMessage