Macro recorder in order to draft script in python

Hi

Would it be possible to have a macro recorder which could draft script in python (for example) ?

Something similar to the macro recorder in Excel

Thanks
Arnaud