How is this POSSIBLE? Running Python code from a STRING | 2minutesPy

preview_player
Показать описание
#function #python #pythonprogramming #code

In this video, we will discuss how code can be executed from a string input in Python.

The exec() function in Python is used to execute code from a string or an external Python file. We'll discover the exec() function.

More 2 Minutes Python Tutorial:

@2MinutesPy
Рекомендации по теме
Комментарии
Автор

You're awesome. These things are never taught outside

chaitanyavaddi
Автор

I wasn't aware of these features of the exec function! I have to admit that the first thing that came to my mind was the eval function which can evaluate a string expression! Thanks for sharing!!!

BillyT
Автор

This is new to me. Thank you for this information. Very helpful.

souravbarua
Автор

Nice. If we want to execute another .Py file based on user input then we can just importing that file in main.py will work or can use exec ? Thx

kashifrana
welcome to shbcf.ru