+ 1

Getting code from a text file in python

I want to get the code from a text file without converting it into a .py file

8th Dec 2019, 10:47 AM
Yash
Yash - avatar
4 odpowiedzi
+ 3
If you want to execute only a single code expression, you can also use "eval".
8th Dec 2019, 12:44 PM
Lothar
Lothar - avatar
+ 1
If you read in a txt file, it will be in string format. You should be able to run that with exec.
8th Dec 2019, 11:50 AM
HonFu
HonFu - avatar
0
HonFu can u give the syntax
8th Dec 2019, 12:01 PM
Yash
Yash - avatar