I was wondering if there is a way to print elements without newlines such as
x=['.','.','.','.','.','.']
for i in x:
print i
and that would print ........ instead of what would normally print which would be
.
.
.
.
.
.
.
.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This can be easily done with the print() function with Python 3.
will give you
In Python v2 you can use the
print()function by including:as the first statement in your source file.
As the print() docs state:
Note, this is similar to a recent question I answered ( https://stackoverflow.com/a/12102758/1209279 ) that contains some additional information about the
print()function if you are curious.