macos 如何使反斜杠 (\) 在 IDLE 中工作?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4798930/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I make backslash (\) work in IDLE?
提问by Kris
I use a Mac and I use Shift+ Alt+ /when I want to type a \
. I'm trying to learn Python and as you can see \ works fine, but not in IDLE.
我使用的是Mac,我使用Shift+ Alt+/当我想输入一个\
。我正在尝试学习 Python,正如您所看到的,\ 工作正常,但在 IDLE 中无效。
How do I make backslash (\) work in IDLE?
如何使反斜杠 (\) 在 IDLE 中工作?
回答by Johannes Maria Frank
Since this problem still persists on OSX 10.8 with python 2.7.5 and 3.3.2 and since this is the first google hit when searching for backslash idle here is a more practical solution instead of copy and pasting: Go to:
由于这个问题在使用 python 2.7.5 和 3.3.2 的 OSX 10.8 上仍然存在,并且由于这是搜索反斜杠空闲时的第一个谷歌点击这里是一个更实用的解决方案,而不是复制和粘贴:转到:
idle->preferences->keys
Under Action-Keys replace:
在操作键下替换:
expand-word <Option-Key-Slash>
with something you like for instance:
比如你喜欢的东西:
expand-word <Control-Option-Key-Slash>
This should fix it.
这应该解决它。
回答by Pankaj
Copy-Paste it from notepad.
or
Use command line python shell.
从记事本复制粘贴。
或
使用命令行 python shell。
回答by JacobJuul
go to
去
idle -> preferences -> General -> default source encoding -> Locale-defined
空闲 -> 首选项 -> 常规 -> 默认源编码 -> 语言环境定义
回答by Yeni
In IDLE, it worked with alt (option)+ i.
在 IDLE 中,它与alt (option)+一起使用i。
回答by Junior
Everyone i have an excellent solution to this problem. Go to "Terminal":
每个人我都有一个很好的解决方案来解决这个问题。转到“终端”:
Write
写
Python
Python
Now it works because it's like using IDLE just in terminal and in terminal the backslash will work perfectly fine.
现在它可以工作了,因为它就像在终端中使用 IDLE 一样,在终端中反斜杠可以正常工作。