Files

925 B

id, source_exercise_id, title, section, source_path, source_repo, source_commit, student_visible_solution, has_private_solution, skip
id source_exercise_id title section source_path source_repo source_commit student_visible_solution has_private_solution skip
practical-python-1.24 1.24 Putting it all back together 1.5 Lists 01_Introduction/05_Lists.md https://github.com/dabeaz-course/practical-python 93dca856b41c61a0a0f85ae334116e4c125629ea false false false

Exercise 1.24: Putting it all back together

Source: Practical Python Programming, 01_Introduction/05_Lists.md.

Exercise 1.24: Putting it all back together

Want to take a list of strings and join them together into one string? Use the join() method of strings like this (note: this looks funny at first).

>>> a = ','.join(symlist)
>>> a
'YHOO,RHT,HPQ,GOOG,AIG,AAPL,AA'
>>> b = ':'.join(symlist)
>>> b
'YHOO:RHT:HPQ:GOOG:AIG:AAPL:AA'
>>> c = ''.join(symlist)
>>> c
'YHOORHTHPQGOOGAIGAAPLAA'
>>>

关联来源