用 $ 字符在 python 中写入文本

Writing text in python with $ character

我正在写以下内容作为降价:

cost_1 = 28 [$/units/year]
cost_2 = 30 [$/units/year]

当我打印它时,因为 "$" 是一个特殊字符,我得到以下内容:

cost_1 = 28 [ //]2=30[ /units/year]

我应该怎么写才能在文中把"$"当成正文?

尝试在字符的开头写 \。

cost_1 = 28 [$/units/year]