求1/n的值里的循环数的循环长度(循环的位数)
pythonic的最大公约数代码(一句话)

python交互式代码自动补全

dcy posted @ 2009年6月15日 00:28 in Python with tags python , 2090 阅读

 python 交互式也同样可以 Tab 键补全,
您可以在启动 python 后,执行下

import readline, rlcompleter; readline.parse_and_bind("tab: complete")

 

import readline
import rlcompleter
readline.parse_and_bind("tab: complete")

 

 

这就可以按 Tab 键补全了。

python 自启动
如果您嫌每次都要键入这东西麻烦的话,可以把上边这行写到 ~/.pythonstartup.py ,
再 ~/.bashrc 里加一个环境变量

export PYTHONSTARTUP=~/.pythonstartup.py


这就会每次启动 python 都先执行了

Emma 说:
2023年1月19日 18:55

Python's "interactive code auto-completion" feature is a great way to quickly and easily get information about the code you're working with. Simply type in a few characters, and the cbd supplements Python interpreter will automatically fill in the rest of the code for you. This can be a great time-saver, especially when you're working with large codebases.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter