DON'T USE THE eval() FUNCTION IN PYTHON!

preview_player
Показать описание
In this video I try to explain why you shouldn't use eval() function in your python code with the help of a practical real world example, which is just a simple test flask server.

eval is a built-in- function used in python, eval function parses the expression argument and evaluates it as a python expression. In simple words, the eval function evaluates the “String” like a python expression and returns the result as an integer.

This is in fact a dangerously incomplete answer. The real answer is that it executes python statements which you pass in and returns the answer back to you. To convert a string number into integer, the safest way you can take is by using the int() function to safeguard your projects.

I hope that this video can help raise awareness to such minute security details that often times developers miss. I will try my best to make more content and increase it's quality with time.

You can find the blog form of this video here: [insert medium link once the article is done]

Feel free to follow me on my socials:

I am also thinking of making a Python for beginners course soon enough. There are enough of Python tutorials you will find online on youtube but I want to make something that potentially gives something more to the students like Python Projects to work on, Python code assignments etc along with the Python Basics in the coding tutorial.

I am also planning on releasing a cybersecurity for beginners video series that aims at explaining the niche spectrums of cybersecurity that I have picked up on in the past two years even though I am a huge noob.
Рекомендации по теме
Комментарии
Автор

Feel free to subscribe if you learned something new :)

xelliot
Автор

What's the alternative to this, because it's not just about converting str to int but it's about evaluating any expression. Can we create our own custom eval like functionality??

satinder_sartaaj