JetBrains IDE-在consol打印消息中可单击的指向本地文件的链接

问题描述

在Python中编码并执行以下代码行时:

print("https://stackoverflow.com/")

enter image description here

它在运行控制台中显示为非常漂亮的链接=)。

但是如何使用本地路径将其存档?

不起作用的是:

print("file:///C:\Programs\something")
print("C:\Programs\something")

enter image description here

解决方法

您必须将这些反斜杠转换为正斜杠:

print("file:///C:\Programs\something".replace('\\','/'))