0

I have a question about merging multiple variables containing text. Each subject in the data set has 10 variables (description1, description2,.....,description10). All of these variables contain 2-3 lines of text for each subject. However, I need to combine all of the descriptions(1-10) to create a variable called all_descriptions for each subject that contains all ten of there descriptions in 1 variable. I’m stuck on how to do this, so I would appreciate some help. Thanks!

1
  • 2
    ' '.join(descriptions) Commented Apr 27, 2020 at 3:57

1 Answer 1

1

Just concatenate them:

desc_list = (description1, description2,.....,description10)
all_descriptions = ''
for i in desc_list:
    all_descriptions += i

or as a one-liner:

all_descriptions = ''.join(desc_list)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.