在Python的IDLE中扩展外壳宽度 [英] Expand width of shell in Python's IDLE

查看:125
本文介绍了在Python的IDLE中扩展外壳宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是python的新手,正在使用Python的IDLE.使用numpy,我创建了一个24 x 24的矩阵.我只是想看看矩阵.我已将显示器上的外壳最大化,因此有足够的空间来打印整个24列的宽度,但是它只打印前13列,然后继续到下一行以打印接下来的11列(在Stack中有麻烦)溢出复制并粘贴正在执行的操作). 外壳"窗口的整个右半部分为空白(正在压缩所有内容以适合左半部分).

I'm new to python and I'm using Python's IDLE. Using numpy, I created a 24 x 24 matrix. I simply want to look at the matrix. I've maximized the shell on my monitor, so there's plenty of room to print the entire 24 columns' width, but it's only printing the first 13 columns of then continuing onto the next line to print the next 11 columns (had trouble in Stack Overflow copying and pasting what it's doing). The entire right half of the Shell window is blank (it's compressing everything to fit in the left half).

这比印刷24列宽的书更难读.谁能告诉我如何说服IDLE使用外壳的整个可用宽度(而不是仅左半部分)进行打印吗?我意识到这是一个愚蠢的问题,请您道歉,但这使我发疯.

This is harder to read than if it printed 24 columns wide. Can anyone tell me how to convince IDLE to print using the entire width available of the shell (rather than just the left half)? I recognize this is a bit of a stupid question and apologize, but it's driving me crazy.

看起来有点像这样(再次,尝试粘贴时出现堆栈溢出问题):

It looks sort of like this (again, Stack Overflow problems in trying to paste):

[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]])

谢谢, 米奇

推荐答案

要做

import numpy as np
np.set_printoptions(linewidth=999999)

有关更多信息,请检查

help(np.set_printoptions)

这篇关于在Python的IDLE中扩展外壳宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆