在 VScode 中,编写 Python 代码时会抛出错误“行太长”。但我想保持线路很长,没有任何错误。我该怎么办?

问题描述 投票:0回答:1

here is the error

# Lists are one of built in data types in python used to store collections of data,
# other 3 are tuple, set and dictionary all with with different qualities and usage.
(the above two line will throw error of line too long.)

thislist = ["apple", "banana", "cherry"]
print(thislist)

我不希望在写长行时出现错误。 我想排很长的队。

python visual-studio-code format vscode-extensions autopep8
1个回答
-2
投票

刚刚在我的机器上尝试过,代码在我的 vscode 上运行得很好 实例。 我无法指出问题所在,但这里有一些可能有效的解决方案:

  1. 进入设置并增加“编辑器:最大标记化行长度”限制。
  2. 也许(无关)打开自动换行。
  3. 尝试将代码复制粘贴到另一个文件中,如果问题仍然存在,也许 重新安装vscode(记得删除隐藏在“C:”深处的文件,比如里面 %应用程序数据%)
© www.soinside.com 2019 - 2024. All rights reserved.