问题
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.
How do I make backslash (\) work in IDLE?
回答1:
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:
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.
回答2:
go to
idle -> preferences -> General -> default source encoding -> Locale-defined
回答3:
Copy-Paste it from notepad.
or
Use command line python shell.
回答4:
In IDLE, it worked with alt (option) + i.
回答5:
Everyone i have an excellent solution to this problem. Go to "Terminal":
Write
Python
Now it works because it's like using IDLE just in terminal and in terminal the backslash will work perfectly fine.
来源:https://stackoverflow.com/questions/4798930/how-do-i-make-backslash-work-in-idle