Print list on separate lines python

Printing each item of a list on a separate line?

PatrickG
Hi! I'm trying to print a list that contains names and when it prints the items in the list all print on the same line. What I want is for each name to print on its own line.

For example this is what I get:

Smith, John Reilly, James Sykes, Matt

What I want is this:

Smith, John
Reilly, James
Sykes, Matt

The names come from user input by the way.

This is my code to print the list:
Expand|Select|Wrap|Line Numbers
  1. visitors.sort[]
  2. print''.join[visitors]
Oct 31 '10 #1
Follow Post Reply
2 34051
dwblas
626 Expert 512MB
Look up traversing a list.
Oct 31 '10 #2
reply
bvdet
2,851 Expert Mod 2GB
Or you can use:
Expand|Select|Wrap|Line Numbers
  1. print"\n".join[visitors]
Nov 1 '10 #3
reply
Message
Cancel Changes

Post your reply

Sign in to post your reply or Sign up for a free account.

Post Reply

Similar topics

PHP
PRINTing a large string � line by line or in one go?
reply views Thread by Kevin Lowe | last post: by
Python
Printing dots in single-line
11 posts views Thread by | last post: by
.NET Framework
Printing a list box
1 post views Thread by NickB | last post: by
C / C++
Printing stl::list objects in gdb
2 posts views Thread by Michael Jasn | last post: by
Python
Printing n elements per line in a list
26 posts views Thread by unexpected | last post: by
C# / C Sharp
DataGridView ComboBox column with databound item list
3 posts views Thread by sklett | last post: by
Javascript
Item List for XML Node in IE
3 posts views Thread by Prashant Mahajan | last post: by
Python
How to list current line in pdb?
2 posts views Thread by Chris Lasher | last post: by
HTML / CSS
best way to put page list on item-list page
1 post views Thread by Zhang Weiwu | last post: by
General
Top 5 Programming Languages To Learn In 2022 And Why should you learn
reply views Thread by Drake Tucker | last post: by
eCommerce
The Best Way to Hire eCommerce Web Developers in 2022
reply views Thread by eddparker01 | last post: by
Mobile Development
How to Hire a Programmer in 6 Easy Steps for a Startup
reply views Thread by eddparker01 | last post: by
General
lancet: a comprehensive, efficient, and reusable util function library of go
reply views Thread by lanliddd | last post: by
Microsoft Access / VBA
Concantenate Numbers and Text in Query
1 post views Thread by jerryg72 | last post: by
General
Access Exif metadata
1 post views Thread by DGrund | last post: by
C# / C Sharp
Access Exif metadata
reply views Thread by DGrund | last post: by
Microsoft Access / VBA
I can not connect my access database to sharepoint site
reply views Thread by MoonNbl | last post: by
Javascript
Calling a PHP page through Javascript
reply views Thread by WIPE | last post: by

Video liên quan

Chủ Đề