how to save python session input and output [duplicate]

2024/11/15 13:59:47

All of the ways which discussed this question save the history of your commands in a file or you have to use an IDE ,I am using vim with python-mode (no mouse using) what I would like to do is to save my session as code I wrote and the python output ,So I dont have to use paper and pen to write my input and python output all what I have to do is to print out my session , I tried the code (.pystartup) and it only save my input and I tried to redirect the output to a file and it only save the python output , is there a way to have both in one file ready to be printed out .

Answer

I really cherish vim, it'S a fantastic piece of work. Nevertheless, your requirements are easier with other tools.

Probably the best choice, in my oppinion, would be to use the ipython notebook. It offers really rich features, including graphics with mpl and much more, and for me is the perfect tool for "reproducible experiments". The full state of a notebook can be saved to disk, reloaded, exported, printed etc.

You should really give it a try.

https://en.xdnf.cn/q/119647.html

Related Q&A

flask_mysqldb Delete FROM variable table [duplicate]

This question already has answers here:Python sqlite3 parameterized drop table(1 answer)How do I use SQL parameters with python?(1 answer)Closed 6 years ago.So i use flask_mysqldb in a Flask(Python we…

Syntax Error at the end of a while loop

EDIT: This question was ask at the start of my learning process for python. The Syntax Error was produced by pythons IDLE with no trackback to speak of. This was the main cause of the problem and confu…

Creating an adjacency list class in Python

I was wondering how to create an adjacency list class Here is what I have so far:class AdjNode:def __init__(self, value):self.vertex = valueself.next = Noneclass Graph:def __init__(self):# Add edgesdef…

How can I separate a rust library and the pyo3 exported python extensions which wrap it

I have a rust library which provides useful functionality for use in other rust programs. Additionally I would like to provide this functionality as a python extension (using pyo3 and setuptools-rust, …

how do I count unique words of text files in specific directory with Python? [closed]

Its difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying thi…

Python convert path to dict

I have a list of paths that need to be converted to a dict ["/company/accounts/account1/accountId=11111","/company/accounts/account1/accountName=testacc","/company/accounts/acc…

Python: How to download images with the URLs in the excel and replace the URLs with the pictures?

As shown in the below picture,theres an excel sheet and about 2,000 URLs of cover images in the F column. What I want to do is that downloading the pictures with the URLs and replace the URL with the…

I cant figure out pip tensorrt line 17 error

I couldnt install it in any way, I wonder what could be the cause of the error. I installed C++ and other necessary stuff I am using windows 11 I installed pip install nvidia-pyindex with no problem. S…

Extracting specific values for a header in different lines using regex

I have text string which has multiple lines and each line has mix of characters/numbers and spaces etc. Here is how a couple lines look like:WEIGHT VOLUME CHA…

Creating a function to process through a .txt file of student grades

Can someone help...My driver file is here:from functions import process_marks def main():try:f = open(argv[1])except FileNotFoundError:print("\nFile ", argv[1], "is not available")e…