存在许多线程的问题,但我仍然不知道如何让它工作。
当我粘贴代码(例如从 ChatGPT 返回的整个方法)并将其粘贴到我的代码中时,必须更正缩进:
def message(self, message, filler="-", newline=True):
"""
Display a message in the console, formatted to fit within the width.
:param message: The message to display.
:param filler: The filler character to use for padding.
:param newline: Whether to print a newline after the message.
"""
max_messagelen = self.width-4
if len(message) > max_messagelen:
message_words = message.split()
在此示例中,我从 ChatGPT 生成了 dcostrings,并希望将它们粘贴到我的函数中。
我希望将我的输入代码调整为粘贴它的行的缩进。 因此,粘贴的代码的每一行都应该有相同数量的缩进,这是一个非常简单的问题。
我想将其设置为自定义快捷方式,这样我仍然可以正常粘贴和正确缩进粘贴。