[Chicago] FW: strange None tailing

Carl Karsten carl at personnelware.com
Fri Apr 12 05:04:28 CEST 2013


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
>>


More information about the Chicago mailing list