Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在调用某个函数时自动保存部分代码_Python_Automation - Fatal编程技术网

Python 如何在调用某个函数时自动保存部分代码

Python 如何在调用某个函数时自动保存部分代码,python,automation,Python,Automation,我有一个python程序。这是主要的伪代码 from myclasses import Class1,Class2,Class3... something... a = Class1() something... 如何将class1自动保存为.txt文件或其他格式的文本文件 例如,当我运行此代码时,将有一个.txt包含以下内容: class Class1(Object): something

我有一个python程序。这是主要的伪代码


from myclasses import Class1,Class2,Class3...

something...
a = Class1()
something...

如何将
class1
自动保存为.txt文件或其他格式的文本文件

例如,当我运行此代码时,将有一个.txt包含以下内容:

class Class1(Object):
    something