Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Print List to Terminal
#1
How do I return all the values of the variable to the terminal rather than just the start and finish of the array please.

elev_t1 = deepcopy(kelevation) 
print(elev_t0)
From terminal
[[ -50.6816 -50.3932 -50.1048 ... -11.6137 -11.7214 -11.8291]
[ -50.6265 -50.3382 -50.05 ... -11.5015 -11.6093 -11.7171]
[ -50.5715 -50.2833 -49.9951 ... -11.3894 -11.4973 -11.6051]
...
[-140.757 -140.547 -140.337 ... -38.2652 -37.9137 -37.5621]
[-141.957 -141.704 -141.45 ... -39.1699 -38.8069 -38.4438]
[-143.157 -142.86 -142.563 ... -40.0747 -39.7001 -39.3255]]
Reply
#2
The obvious way: iterate over it and print each item.
Reply
#3
Some relevant information is missing - this is numpy array, not just 'variable'.

In numpy you can set threshold with numpy.set_printoptions or if you need to do it once with context manager numpy.printoptions

import numpy as np

arr = np.zeros(10000).reshape(100, 100)

with np.printoptions(threshold=np.inf):       # or some specific value
    print(arr)
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How do you get Python to print just one value in a list? 357mag 3 1,003 May-17-2023, 09:52 PM
Last Post: rob101
  Python VS Code: using print command twice but not getting output from terminal kdx264 4 1,073 Jan-16-2023, 07:38 PM
Last Post: Skaperen
  Using print command to send command to rasberry pi terminal MondazeBear 2 1,854 Aug-02-2021, 03:15 PM
Last Post: Larz60+
  Print max numbers in a list jimmoriarty 1 2,144 Sep-25-2020, 07:29 AM
Last Post: DPaul
  Print variable values from a list of variables xnightwingx 3 2,614 Sep-01-2020, 02:56 PM
Last Post: deanhystad
  Print the number of items in a list on ubuntu terminal buttercup 2 1,930 Jul-24-2020, 01:46 PM
Last Post: ndc85430
  taking input doesnt print as list bntayfur 2 2,095 Jun-04-2020, 02:48 AM
Last Post: bntayfur
  print result in OUTPUT not in TERMINAL picasso 1 2,048 Apr-15-2020, 03:51 PM
Last Post: deanhystad
  Taking brackets out of list in print statement pythonprogrammer 3 2,376 Apr-13-2020, 12:25 PM
Last Post: perfringo
  Trying to print corresponding elements in two different list Darthmarvolo 5 2,576 Mar-03-2020, 04:29 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020