+ 4
List Problem
I want to extract the content of an inner list but I keep getting a newline print after each iteration. End='' doesn't work, sep='' likewise. Please how do I tell tell Python to print on another line only when the content of the list is finished? https://code.sololearn.com/cat449bXe273/?ref=app
7 Respostas
+ 3
import numpy as np
name = [['0','-','-','-'],
['0','0','0','0'],
['0','-','-','-']]
q = np.rot90(name,-1)
print(q)
print()
for i in q:
print(i)
for i in q:
for j in i:
print(j,end='')
print()
+ 3
The print() after the print(whatever,end='') works magic. Deepak thanks man. Jay Matthews thank you
+ 2
Waoh! Thanks guys.
But can something like this be done without Numpy???
+ 1
You can do like that even
+ 1
Well Yes you can do it also
+ 1
q = [['0','-','-','-'],
['0','0','0','0'],
['0','-','-','-']]
print('[',end='')
for i in range(len(q)):
if i==len(q)-1:
print(q[i],end=']')
print()
break
print(q[i])
print()
for i in q:
print(i)
for i in q:
for j in i:
print(j,end='')
print()
+ 1
Anytime😊 keep coding