Correct way to write line to file?

How do I write a line to a file in modern Python? I heard that this is deprecated:

print >>f, "hi there"

Also, does "\n" work on all platforms, or should I use "\r\n" on Windows?

← Назад к списку