Rlcomplete defines the command auto-complement function for the ReadLine module.
When the module is imported under the UNIX platform (provided that the ReadLine module is available), an instance of complete is automatically generated and its complete () method is set to ReadLine's auto-completion function.
For example:
-
>>> import Rlcompleter >>>import ReadLine >>> readline.parse_and_bind ( tab:complete ) >>> Readline.<tab pressed>readline. __doc__ Readline.get_line_buffer (Readline.read_init_file (readline. __file__ Readline.insert_text (Readline.set_completer (readline. __name__ Readline.parse_and_bind ( >>> readline.
The Rlcomplete module is designed to be used in Python interactive mode, and the user can add the following commands to the Python initialization file (determined by the environment variable Pythonstartup) so that you can use the TAB key to get the completion command automatically.
-
Span style= "color: #0000ff;" >try : import Readlineexceptimporterror: print " module readline not available. " else : import Rlcompleter Readline.parse_and_bind ( " tab:complete )
Complete object The complete object has the following methods: completer.complete (text, state): Returns the status code for the auto-complete command.
Command Auto-complete module rlcomplete