![](/img/trans.png)
[英]How do I increase the cell width of the ipython notebook in Enthought Canopy?
[英]How do I find the width of an IPython cell?
pandas 數據框在 ipython 單元格中顯示得很好。 它是如何做到的?
獲取 Python 控制台寬度的常規方法似乎不適用於 ipython 單元格。
如果您只想查看大小,可以使用此腳本:
from IPython.display import display, HTML
js = """<script>
alert($( ".cell").width())
</script>"""
display(HTML(js))
如果你想在代碼中使用,你可以將它分配給一個變量並在下一個單元格中使用它:
from IPython.display import display, HTML
js = """<script>
IPython.notebook.kernel.execute("cell_width="+($( ".cell").width()))
</script>"""
display(HTML(js))
在下一個單元格中:
print(cell_width)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.