I have this amazing code that I would like to write the output to a textfile not quite sure how to write the data it gives me automatically into a text file?
import random
members = 5
participants=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
random.shuffle(participants)
for i in range(len(participants) // members + 1):
print('Group {} consists of:'.format(i + 1))
group = participants[i*members:i*members + members]
for participant in group:
print(participant)
Then also once its written how can I get it to read out the data out of the text file?
Thank you for any comments or answers!
Aucun commentaire:
Enregistrer un commentaire