Python — How do you view output that doesn't fit the screen?

前端 未结 9 1853
挽巷
挽巷 2021-02-05 10:27

I should say I\'m looking for a solution to the problem of viewing output that does not fit on your screen. For example, range(100) will show the last 30ish lin

9条回答
  •  半阙折子戏
    2021-02-05 10:57

    If you work in ipython you can issue shell commands within your interactive python session. That means that you just do

    In [1]: less myfile.txt
    

    I also really like being able to arrow up and down to get previous commands and getting the output from previous commands by doing something like

    In [33]: print cos(Out[7]*pi/180)
    

提交回复
热议问题