New export script

Hi, i’m new to python.
I’d like to make an export script in Blender 2.5 however i’m unshure how to write information to files could someone please provide me with a simple example?

file = open(filename, “w”)
file.write(“bla”)
file.close()

Thank you! that’s just what I was looking for.