# Read the content from the file
with
open("myfile.txt", "r") as file:
content = file.read()
#
Split the content into words
words
= content.split()
# Write each word in a separate line to a new file
with
open("transformed_file.txt", "w") as new_file:
for word in words:
new_file.write(word + "\n")
print("Content
transformed and saved to transformed_file.txt")
No comments:
Post a Comment