天蓬老师2017-04-18 10:02:40
In what environment did you encounter this problem?
Single quotes are no problem, and I can run it on my own Python 2.7.5.
m = open('tmp.txt', 'a')
b = 'nghost'
m.write(b)
m.close()
According to the environment of the questioner, I tried it again and it was ok.
伊谢尔伦2017-04-18 10:02:40
The writing method of three quotation marks is mainly used to avoid string escaping. In python, there are single quotation marks, double quotation marks and three quotation marks. For details, you can check python: single quotation marks, double quotation marks and triple quotation marks. Difference