import de la formation python de Gwen
This commit is contained in:
28
python/formation/snippets/pystartup
Normal file
28
python/formation/snippets/pystartup
Normal file
@ -0,0 +1,28 @@
|
||||
# Add auto-completion and a stored history file of commands to your Python
|
||||
# interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
|
||||
# bound to the Esc key by default (you can change it - see readline docs).
|
||||
#
|
||||
# Store the file in ~/.pystartup, and set an environment variable to point to
|
||||
# it, e.g. "export PYTHONSTARTUP=/max/home/itamar/.pystartup" in bash.
|
||||
#
|
||||
# Note that PYTHONSTARTUP does *not* expand "~", so you have to put in the full
|
||||
# path to your home directory.
|
||||
import rlcompleter
|
||||
import readline
|
||||
readline.parse_and_bind("tab: complete")
|
||||
|
||||
import os
|
||||
histfile = os.path.join(os.environ["HOME"], ".pyhist")
|
||||
try:
|
||||
readline.read_history_file(histfile)
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
import atexit
|
||||
atexit.register(readline.write_history_file, histfile)
|
||||
del os, histfile
|
||||
|
||||
# enhanced completion
|
||||
#import rlcompleter2
|
||||
#rlcompleter2.setup()
|
||||
|
Reference in New Issue
Block a user