P
P
Povsekakiy Ivanov2014-11-01 19:10:07
Python
Povsekakiy Ivanov, 2014-11-01 19:10:07

How to display the contents of a list as a single line?

There is a list chart:
chart = ["Q", "A", "D", "W"]
if you use the print(chart) command, you get the following:
["Q", "A", "D", "W" "]
how do I output the contents of the list as a single line without spaces? Like this:
QADW
Thank you in advance to all who responded.
P.S. Python 3.4.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
[
[email protected]><e, 2014-11-01
@Povsekakij

print "".join(chart)if there are already rows in chart. Otherwiseprint "".join(map(str, chart))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question