本文介绍了带自动关闭括号/引号的iPython/Jupyter中的docstring(三重引号)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Python 2.7在 Jupyter笔记本中使用带三引号的 docstrings .

I'm trying to use docstrings w/ triple-quotes in my Jupyter notebooks using Python 2.7 .

我可以禁用自动关闭括号/引号,但是我很热衷于它们.工作流程的大幅增加.

I can disable the autoclose brackets/quotes thing but I'm quite keen on them; major increase in workflow.

在保持自动关闭功能的同时,有人知道如何在不过度引用的情况下进行三重引用吗?

如果我按" 3x ,我会得到"""";
如果我按一次 3x delete ,我会按"" ;和如果按两次 3x delete ,我会得到"

If I press the " key 3x I get """""";
If I press it 3x and delete once, I get """" pressing; andIf I press it 3x and delete twice, I get ""

烦人吧?我怎样才能兼得两全(自动关闭|文档字符串)?

这是一个非常低级的问题,但是我在任何地方都没有看到简单的解决方法,因此答案对于社区应该是有用的.如果您投反对票,请您解释一下为什么这是一个糟糕的问题吗?

This is a pretty low-level question, but I haven't seen an easy fix anywhere so the answer should be useful for the community. If you downvote, can you explain why this is a poor question please?

推荐答案

没有错.当您键入三个时,光标将位于结果六个字符的中间.因此,您键入的任何内容都在字符串中,并且已自动关闭.

Nothing is wrong. When you type three " your cursor is at the middle of the resulting six. Thus, anything you type is within the string and has been auto-closed.

键入以下确切的字符串:"这可以正常工作,而无需单击或移动光标.结果将是正确格式的字符串,因为它将自动关闭该字符串.因此,您同时具有字符串和自动关闭功能.

Type this exact string of characters: """This is working without clicking or otherwise moving the cursor. The result will be a correcly formatted string, because it will have auto-closed the string. Therefore you have both strings and autoclose.

这篇关于带自动关闭括号/引号的iPython/Jupyter中的docstring(三重引号)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 01:31