Dave Angel <[email protected]> Wrote in message:
> Zhen Zhang <[email protected]> Wrote in message:
>>
>
>> I am currently running python 2.7.
>>
>> Yes, i thought there must be a print function in python like fprint in C++
>> that allows you to print into a file directly.
>> But i google about "print string into text file" I got answers using
>> f.write() instead. :)
>> --
>>
Oops. Forgot the newline.
> In python 2.x,
>
> Instead of
> f.write (a + " " + b)
f.write (a + " " + b + "\n")
> you can use
> print >> f, a, b
>
print will add in the space and newline, just as it does to
sys.stdout.
--
DaveA
--
https://mail.python.org/mailman/listinfo/python-list