Last active
September 25, 2024 13:49
-
-
Save twneale/5245670 to your computer and use it in GitHub Desktop.
.pythonrc file that adds command history and tab completion to my python shell.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Save this file and add the following line to your ~/.bashrc" | |
export PYTHONSTARTUP="$HOME/.pythonrc" | |
''' | |
import os | |
import readline | |
import rlcompleter | |
import atexit | |
history_file = os.path.join(os.environ['HOME'], '.python_history') | |
try: | |
readline.read_history_file(history_file) | |
except IOError: | |
pass | |
readline.parse_and_bind("tab: complete") | |
readline.set_history_length(1000) | |
atexit.register(readline.write_history_file, history_file) | |
del readline, rlcompleter, atexit, history_file | |
# In addition to os, import some useful things: | |
import re | |
from collections import * | |
from itertools import * |
is the indentation good? specially at line 15
Yes, it's a python file
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is the indentation good? specially at line 15