Python Forum
hide object type in printing
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
hide object type in printing
#1
Hi
I have an 2d array A.which each elements of it is a list . when I print A, It gives me sth like this:

[list([]) list([]) list([])]
[list([]) list([]) list([])]
[list([]) list([]) list([])]]

but i dont like to show 'list' word in the print result! Sad
thanks for ur help in advance.
+i use python 3
Reply
#2
Please, post whatever code you have - in python tags
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
this is what I wrote:

import numpy as np
A=np.zeros((3,3),dtype=object) #or object

for i in range(3):
    for j in range(3):
        A[i,j]=[] #wanna be empty list to be filled later 

print(A)
output:
Output:
[list([]) list([]) list([])] [list([]) list([]) list([])] [list([]) list([]) list([])]]
Reply


Forum Jump:

User Panel Messages

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