Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJustin Kinney
445 Pointshow do I turn a list into a string?
hey can any of you guys help me Im having a little trouble
full_name = 'Justin Kinney'
name_list = full_name.split(' ')
greeting_list = "Hi, I'm Justin Kinney".split(' ')
greeting = greeting_list
Justin Kinney
445 Pointsnvm i solved it
2 Answers
Charlie L.
10,120 PointsJust to clarify for other people that may have the same problem.
greeting_list = "Hi, I'm Justin Kinney".split(' ') # returns the list ["Hi,", "I'm", "Justin", "Kinney"]
To make this list back into one string, you can use the str.join() method.
one_sentence = ' '.join(greeting_list) # returns the one sentence "Hi, I'm Justin Kinney"
Think of split() and join() as opposites of one another.
Justin Kinney
445 Points.join()
Justin Kinney
445 PointsJustin Kinney
445 Pointsits saying to turn the "Hi, I'm Justin Kinney" into a list