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

    Assuming you are using Python 3: 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 …

  2. 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, he's making a new …

  3. 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.

  4. 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.

  5. 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.

  6. 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...

  7. 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.

  8. 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 functions.

  9. 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 columns. fooli...

  10. python - Print a list of space-separated elements - Stack Overflow

    I want to print them in one line with a single space as a separator. But I don't want a space after the last element of the list (or before the first). In Python 2, this can easily be done with the following code. …