Every time I run my code and input data it comes out like this. (['d', 'e', 'c', 'e', 'm', 'b', 'e', 'r']), How do I combine it into a single word?
time = 0
times = int(input('How many months do you want to save?'))
for time in range(times):
if time <= times:
time = time 1
month = input('What is your favorite month?')
list1 = list(month)
save_data = open('month.text','a')
save_data.write('\r\n')
save_data.write(str(list1))
save_data.close()
CodePudding user response:
Just write the month
directly
time = 0
times = int(input('How many months do you want to save?'))
for time in range(times):
if time <= times:
time = time 1
month = input('What is your favorite month?')
save_data = open('month.text','a')
save_data.write('\r\n')
save_data.write(month)
save_data.close()