Sure.

file = open("mylines.txt", "w")
for i in range(10):
     f.write("This is line %d\r\n" % (i+1))
f.close

Using the open function I open a file, or create one if it doesn't exist. Then I write into it using write(). Finally, I close the instance of the file.
spam fails_task pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence