Tab键不在Python中缩进

Joe*_*Joe 3 python shell python-2.7

我最近升级到python2.7并注意到tab键在shell中无法正常运行.相反,它似乎搜索基础目录(标准的unix行为).

如果我改回到python2.6,它会正常工作.有没有办法将此功能添加回2.7?

例如:

if foo :(
tab here)print'bar'#desired behavior is tab键在这里添加缩进

解决方案:
这是Mac OSX上python2.7的已知问题.我使用以下解决方法来纠正它:

$ cat > $HOME/.pystartup
import readline
if 'libedit' in readline.__doc__:
   readline.parse_and_bind("bind ^I ed-insert")
^D
$ export PYTHONSTARTUP=$HOME/.pystartup
Run Code Online (Sandbox Code Playgroud)

Tho*_*omi 9

这是Mac OSX上python 2.7的已知错误.可以在错误报告中找到更多详细信息(包括修复).