Is it possible to output a similar list in two lines without causing twice print ()?
print ('rows:', len (a), ';', 'columns:', Len (A [0]), '.', SEP = '')
To succeed in two lines:
Rows: Len (A) ;
Columns: Len (A [0]) .
and not in one:
Rows: LEN (A) ; Columns: Len (A [0]) .
Answer 1, Authority 100%
To split the strings, the \ N
symbol is quite suitable. It is enough to put it in the place where the row transfer is needed.
I also wanted to see that it is clearly used to use the corresponding Python capabilities for formatted output, for example, formatting method:
print ('rows: {}; \ NStolbtsov: {}.'. Format (Len (A), Len (A [0])))
So immediately becomes clearer the structure of the recorded information.
You can even write this:
print ('rows: {}; \ n'
'Columns: {}.'. Format (Len (A), Len (A [0])))
Sometimes the Formatting Operator %
:
print ('rows:% s; \ n'
'Columns:% s.' % (Len (A), Len (A [0])))
Record with its use, mostly shorter, but maybe less understandable.
Answer 2
Try to use “\ n”. Must work.
Answer 3
print ('rows:', len (a), ';', '\ NStolbtsov:', Len ( A [0]))