About 518,000 results
Open links in new tab
  1. python - Pythonic way to print list items - Stack Overflow

    print(*myList, sep='\n') This is a kind of unpacking. Details in the Python tutorial: Unpacking Argument Lists You can get the same behavior on Python 2 using from __future__ import …

  2. How to print a list in Python "nicely" - Stack Overflow

    If you really need it in Python 2.7, you could still import the print function from future from __future__ import print_function Thanks for the comment.

  3. python - How to "properly" print a list? - Stack Overflow

    Mar 27, 2011 · Here's an interactive session showing some of the steps in @TokenMacGuy's one-liner. First he uses the map function to convert each item in the list to a string (actually, …

  4. In Python, is there an elegant way to print a list in a custom format ...

    Take a look on pprint, The pprint module provides a capability to “pretty-print” arbitrary Python data structures in a form which can be used as input to the interpreter.

  5. Print list without brackets in a single row - Stack Overflow

    Jun 24, 2012 · @FredrickGauss if you add from __future__ import print_function it'll work in python 2 as well.

  6. Printing list elements on separate lines in Python

    As initialized upon program startup, the first item of this list, path [0], is the directory containing the script that was used to invoke the Python interpreter.

  7. python - Print list of lists in separate lines - Stack Overflow

    I have a list of lists: a = [[1, 3, 4], [2, 5, 7]] I want the output in the following format: 1 3 4 2 5 7 I have tried it the following way , but the outputs are not in the desired way: for i i...

  8. How do I get the number of elements in a list (length of a list) in …

    Nov 11, 2009 · Explanation Everything in Python is an object, including lists. All objects have a header of some sort in the C implementation. Lists and other similar builtin objects with a …

  9. How can I format a list to print each element on a separate line in ...

    Dec 6, 2015 · Brilliant! I never thought of unpacking a list in the context of print(). I've long wondered how to implement this in a simple way. Much prefer this to looping or calling str …

  10. python - How to print a list more nicely? - Stack Overflow

    Jun 16, 2015 · This is similar to How to print a list in Python “nicely”, but I would like to print the list even more nicely -- without the brackets and apostrophes and commas, and even better in …