qq524061227 发表于 2017-5-4 08:13:35

why python doesn't have a writeline() method like c# ?

<script src="http://pagead2.googlesyndication.com/pagead/expansion_embed.js"></script><script>google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad);</script><script>google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad);</script>  just curious, it would make writing to a file  a bit easier?
  ww <mrwwli <at> gmail.com> writes:

>
> just curious, it would make writing to a file  a bit easier?

Because readline() returns the line with the newline attached,writeline() would
have to require a newline at the. Therefore, it would be equivalentto write()!

Just use f.write("some line\n").
  from
  http://www.opensubscriber.com/message/python-list@python.org/11602035.html 
  

  blog client has some thing wrong,i write two times,but it disappear  curious,so finally i put the link over here as a memo


http://img.zemanta.com/pixy.gif?x-id=70908f15-2d32-8eae-b960-1853659f05fe
页: [1]
查看完整版本: why python doesn't have a writeline() method like c# ?