Is it possible to open a file with code already in it? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Is it possible to open a file with code already in it?

Is there a way I can open a file with code already in it and see if it can run?

25th Sep 2019, 5:14 PM
Shyheim Ali
Shyheim Ali - avatar
2 Réponses
+ 4
You could import it as a module, which runs the code, but I think the "right way" would be by running the code from the command prompt. You can use system method from module os to run commands in command prompt. import os os.system("py path&filename")
25th Sep 2019, 5:29 PM
Seb TheS
Seb TheS - avatar
0
Thank you 🙏 Toni Isotalo
25th Sep 2019, 5:25 PM
Shyheim Ali
Shyheim Ali - avatar