Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert list of strings to space-separated string

I am using underscores to represent the length of a unknown word. How can I print just the underscores without the brackets that represent the list?

Basically, if I have a list of the form ['_', '_', '_', '_'], I want to print the underscores without printing them in list syntax as "_ _ _ _"

like image 962
user1718826 Avatar asked Oct 26 '12 21:10

user1718826


1 Answers

Does this work for you

>>> my_dashes = ['_', '_', '_', '_']
>>> print ''.join(my_dashes)
____
>>> print ' '.join(my_dashes)
_ _ _ _
like image 161
inspectorG4dget Avatar answered Sep 19 '22 13:09

inspectorG4dget