python3.x - python open函数中,write方法写入字符串为什么要3个单引号?
阿神
阿神 2017-04-18 10:00:40
0
2
584
阿神
阿神

闭关修行中......

reply all (2)
Peter_Zhu

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.

    伊谢尔伦

    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

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!