I need to create a text file called Names_ages.txt using the following list
Josh 14
Lauren 16
Paul 18
Mason 15
Lily 17
Stephanie 15
If anyone can help me and understand how to create one, that would be greatly appreciated :)
I need to create a text file called Names_ages.txt using the following list
Josh 14
Lauren 16
Paul 18
Mason 15
Lily 17
Stephanie 15
If anyone can help me and understand how to create one, that would be greatly appreciated :)
This creates a text file from a list:
outfile = open("Names_ages.txt",'w')
name_list = ["Josh 14", "Lauren 16", "Paul 18", "Mason 15", "Lily 17", "Stephanie 15"]
outfile.write("\n".join(name_list))