How to invert console history order in pycharm for copy pasting?

妖精的绣舞 提交于 2019-12-05 05:13:19

Another option is that if you have ipython installed, then your python console will by default use ipython. And you could use the %history magic command of ipython to print out your history for copy.

c.f. http://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-history

just write a short code to reverse it:

#triple string quotes over multiple lines
code= """
df = pd.read_csv('path_to_file')
import pandas as pd
""" #end of multiline quote

split_by_line = code.split("\n")

split_by_line.reverse()

print("\n".join(split_by_line))

note: I have never worked with pycharm so this maay not work properly for blocks (if, for etc)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!