On 31/08/12 02:12, Ashley Fowler wrote:
Can anyone help me edit this code below to return the list in the form
of a column instead of a row?

def printList():
     list1 = input("Insert a list")
     list = [list1]
     print (list)

First you need to convert the string that your user types into a list of individual entries. At the moment your list consists of a single string so the column will only have a single line.

You probably want to look at the split() method of strings.

Alternatively you could write a loop which reads each entry individually from the user.

HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to