Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
.pythonrc file that adds command history and tab completion to my python shell.
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')
except IOError:
readline.parse_and_bind("tab: complete")
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 *

This comment has been minimized.

Copy link

@Luxcium Luxcium commented Jul 14, 2019

is the indentation good? specially at line 15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment