Search code examples
pythonmarkdownspecial-characters

Writing text in python with $ character


I am writing as markdown the following:

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

and when I print it, because the "$" is a special character, I am obtaining the following:

cost_1 = 28 [ /𝑢𝑛𝑖𝑡𝑠/𝑦𝑒𝑎𝑟]𝑐𝑜𝑠𝑡2=30[ /units/year]

How should I write it in order to use the "$" as a regular character in the text?


Solution

  • Try writing \ in the beginning of the character.

    cost_1 = 28 [\$/units/year]