[Chicago] FW: strange None tailing

shangyu yushang at outlook.com
Fri Apr 12 05:18:25 CEST 2013


I've checked my code , in fact , I wrote the following lineprint >>f, test(f)that's why I got the strange None in tail . Many thanks!!!

> From: carl at personnelware.com
> Date: Thu, 11 Apr 2013 22:04:28 -0500
> To: chicago at python.org
> Subject: Re: [Chicago] FW: strange None tailing
> 
> for those wondering...
> 
> carl at dc10:~/temp$ cat foo.py
> 
> def test(f):
>   print >>f, "zzzz"
> 
> def main():
>   f = open("test.cfg","w")
>   test(f)
>   f.close()
> 
> if __name__=='__main__':
>   main()
> carl at dc10:~/temp$ python foo.py
> carl at dc10:~/temp$ cat test.cfg
> zzzz
> carl at dc10:~/temp$
> 
> -- 
> Carl K
> 
> 
> On Thu, Apr 11, 2013 at 9:56 PM, Carl Karsten <carl at personnelware.com> wrote:
> > Um, main() never gets called.
> >
> > Carl K
> >
> >
> > On Thu, Apr 11, 2013 at 9:45 PM, shangyu <yushang at outlook.com> wrote:
> >> Sorry , the correct code is
> >>
> >> def test(f):
> >>   print >>f, "zzzz"
> >>
> >> def main():
> >>   f = open("test.cfg","w")
> >>   test(f)
> >>   f.close()
> >>
> >> ________________________________
> >> From: yushang at outlook.com
> >> To: chicago at python.org
> >> Subject: strange None tailing
> >> Date: Fri, 12 Apr 2013 10:41:44 +0800
> >>
> >>
> >> Hi dear all,
> >> I've wrote the following Python code :
> >>
> >> def test(f):
> >>   print >>f, "zzzz"
> >>
> >> def main():
> >>   f = open("test.cfg","w")
> >>   test(f)
> >>   f.close(
> >> when open the test.cfg file I got the following lines
> >> zzzz
> >> None
> >>
> >> Why there is such a strange None output ?
> >>
> >> _______________________________________________
> >> Chicago mailing list
> >> Chicago at python.org
> >> http://mail.python.org/mailman/listinfo/chicago
> >>
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20130412/72d251e9/attachment-0001.html>


More information about the Chicago mailing list