Hi, how do I write a list to a file on mac os x?

I have tried everything.....


file = open('test.txt', 'w')
mylist = ["rocks","box"]
file.write("This doesnt work either")
file.write(str(mylist))

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.