Skip to content

Tag: python

How to create a Dockerfile for streamlit app

I am aiming to deploy a web-app written with Sreamlit, I can run this on my local machine by running streamlit run Home.py in my command line. However, I’m not sure how to create the docker file. Any advice? Answer In order to Dockerise your app you need two files: Dockerfile : describes the image struc…

Improve the speed of code with if else statements

I am working on building a classs. But I realized that one part is extremly slow. I believe it is this part below, because when I call it, it takes couple of minutes which is too long. How can the speed of the function be improved? Not sure how the code can be improved to increase speed. There is a

DNS Packet IP Address Structure

I have been writing a python program that builds a packet and sends a reverse DNS lookup request to a DNS server. I have a problem the IP address is stored in hex in a way that is difficult to understand. In the hex field it has the number of each iteration with a 3 in front of it, so

Python hangman Game explaination

I’m having problems wrapping my head around this for loop code. which was part of a Udemy course online and the teacher’s code for the hangman project. This part I understand as we are casting the number of letters in the chosen word into an underscore. This is the part I just do not understand. l…

Python – Find distinct domains inside a list of dictionaries

I have a list (with dictionaries inside) and I want to know how many different domains are inside it. I have something like this: The desired result would look like this: Or maybe just: Both would be OK, so whatever is easier or faster I guess. I think I could use Regex for this, but maybe there are more pyth…