How do I make backslash (\) work in IDLE?

旧巷老猫 提交于 2019-12-24 10:15:52

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!