Python转义字符\

如果像下面这样写的话,会直接被IDE红线报错

course = "python "programming""
print(course)

image-20220816185941061

那么我想打印出python "programming"这样的字符串怎么办呢?

这就要用到转义字符了

course = "python \"programming\""
print(course)

image-20220816190116076

可以看到红线消失了,我们运行一下看看

image-20220816190143267