-1

This may be a simple question however, I'm currently doing an assessment and I'm on the final section.

What I need to do is write a list to a text file, but in string format. What I mean by this is for example if I want the list ['the', 'cat', 'sat', 'on', 'the', 'mat'] if I want to write this list to a text file it writes it in this format, when I need it to be written in continuous prose so the cat sat on the mat. I'm not sure how to do this? I tried adding str before the .write command but this doesn't solve my problem.

1 Answers1

2

Try this: F.writeline(" ".join(your_list))

kiecodes
  • 1,642
  • 14
  • 28
Bipul Jain
  • 4,523
  • 3
  • 23
  • 26