On 15/09/2021 15:39, Abdur-Rahmaan Janhangeer wrote:
Greetings,

If i have a file name flower.py and i add x = 1 in it.
When i run python -i flower.py i get a shell


If type x i get 1
x
1

The values are auto injected.

How do i start a shell by code with values already injected? Thanks

Kind Regards,

I tried

import code

x = 42
code.interact(local=globals())

but didn't bother to read the documentation at

https://docs.python.org/3/library/code.html

and thus do not know what the limitations might be.

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to