0

Possible Duplicate:
How to join list of strings?

I have a couple of functions in a module to run. First, I have to use read() to read strings in a document and save it as new_string and run a function. Then, I need to read a document using readlines(). After running the first function like match = clean_passage(new_string) then match contains ['/n', 'asdf', 'dfg']. Now, I need them in a line as it is shown in the original document. So, asdf dfg. How can I convet match into a thing that contains strings in a similar fashion that we get when we read a document using readlines().

So far, to do this, I had to save it and then open it using readlines(), which takes time. Is there any way to do that using a simple command? Sorry if the explanation is not clear.

Community
  • 1
  • 1
Jimmy
  • 161
  • 3
  • 13

1 Answers1

4

try this:

to_convert  =  ['/n', 'asdf', 'dfg']

original_line = " ".join(to_convert)
levi
  • 22,001
  • 7
  • 73
  • 74