简体   繁体   English

如何在IDLE中使反斜杠(\\)工作?

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

I use a Mac and I use Shift + Alt + / when I want to type a \\ . 我要使用Mac,并且要输入\\时,请使用Shift + Alt + / I'm trying to learn Python and as you can see \\ works fine, but not in IDLE. 我正在尝试学习Python,正如您所见,\\效果很好,但在IDLE中却不行。

How do I make backslash (\\) work in IDLE? 如何在IDLE中使反斜杠(\\)工作?

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: 由于此问题在OSX 10.8和python 2.7.5和3.3.2上仍然存在,并且由于这是搜索反斜杠空闲时的第一个Google匹配,因此这里提供了一种比复制和粘贴更实用的解决方案:

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. 这应该解决它。

在IDLE中,它与alt(option) + i一起使用

Copy-Paste it from notepad. 从记事本复制粘贴。
or 要么
Use command line python shell. 使用命令行python shell。

go to

idle -> preferences -> General -> default source encoding -> Locale-defined 空闲->首选项->常规->默认源编码->区域设置

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. 现在它可以工作了,因为就像在终端中使用IDLE一样,在终端中反斜杠也可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM