在Anaconda中设置Python缩进 [英] Set a Python indent in Anaconda

查看:208
本文介绍了在Anaconda中设置Python缩进的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个问题.我用Python 3.5.2安装了Anaconda,当我选择cmd>python时,解释器已打开,然后当我尝试时:

So I've got a problem. I installed Anaconda with Python 3.5.2 and when I go for cmd>python then interpreter is on, and then when I try:

for i in range(10):
    print(i)

然后弹出一条消息(当我按TAB键时):

Then a message pops out (when I press TAB):

Readline internal error
Traceback (most recent call last):
  File "C:\Anaconda3\lib\site-packages\pyreadline\console\console.py", line 768, in hook_wrapper_23
    res = ensure_str(readline_hook(prompt))
  File "C:\Anaconda3\lib\site-packages\pyreadline\rlmain.py", line 571, in readline
    self._readline_from_keyboard()
  File "C:\Anaconda3\lib\site-packages\pyreadline\rlmain.py", line 536, in _readline_from_keyboard
    if self._readline_from_keyboard_poll():
  File "C:\Anaconda3\lib\site-packages\pyreadline\rlmain.py", line 556, in _readline_from_keyboard_poll
    result = self.mode.process_keyevent(event.keyinfo)
  File "C:\Anaconda3\lib\site-packages\pyreadline\modes\emacs.py", line 243, in process_keyevent
    r = self.process_keyevent_queue[-1](keyinfo)
  File "C:\Anaconda3\lib\site-packages\pyreadline\modes\emacs.py", line 286, in _process_keyevent
    r = dispatch_func(keyinfo)
  File "C:\Anaconda3\lib\site-packages\pyreadline\modes\basemode.py", line 257, in complete
    completions = self._get_completions()
  File "C:\Anaconda3\lib\site-packages\pyreadline\modes\basemode.py", line 200, in _get_completions
    r = self.completer(ensure_unicode(text), i)
  File "C:\Anaconda3\lib\rlcompleter.py", line 80, in complete
    readline.redisplay()
AttributeError: module 'readline' has no attribute 'redisplay'

虽然我去2个空格也可以.我是否可以将Anaconda设置为也接受TAB缩进?

It's okay when I go for 2 spaces though. Can I set Anaconda to accept TAB indents as well?

推荐答案

对于范围(10)中的i:按Enter ... print(i)-在最后一个点和p之间插入三个空格,然后按Enter. 在下一行中将有三个点,并且(闪烁)光标在最后一个点之后是一个空格.

for i in range(10):press Enter ... print(i)--- between last dot and p, insert three spaces and hit Enter. In the next line there will be three dots and the (blinking) cursor is one space after the last dot.

按Enter键,您将看到输出

Press enter and you see the output

这是Windows 10 Insiders Preview Build 17127.rs4_release和Python 3.6.2中的

This was in Windows 10 Insiders Preview Build 17127.rs4_release and Python 3.6.2

这篇关于在Anaconda中设置Python缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆