I am trying to password protect my zip file(with multiple txt files) using pyminizip.commpress_multiple This is creating a password-protected zip file. When I try to extract the zip file for the first time it is prompting for the password. From the second time onwards, it is not asking for the password. Any i…
How to assign different permissions to users with different levels in Python?
I’m creating a simple login GUI. I’m trying to make it so that level 3 users can access all requests, level 2 users can only access database and sales related requests, and level 1 users can only access the sale requests. However, I’m stuck on trying to retrieve the level info and using it i…
How do i return a string if a list is empty in python
I’m fairly new to coding, but what this project is asking, is to complete the function so that if a list is empty, it returns the string “does not exist” but currently, it comes up with a bunch of errors. How do I go about adding a function within my lowest_number definition that returns a s…
How find the distance in meters between two points in a dataframe?
I have a dataframe where, columns with subscript 1 are starting points and with 2 are end points. I want to find a difference in kilometers between them. I tried following code however got an error ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all(). Answe…
Why is it that when I return int(n) where n is a float it will still return a float?
So I’ve been trying to make a program to convert float into a integer and if the input is not a float (such as a string) just return the string: However when I give it a float such as 1.0 it will only return 1.0 and totally not convert it. Does anyone know what is going on here? Any help
How to access a specific p tag while using BeautifulSoup
Hello everyone I’m having trouble while using BeautifulSoup , indeed i don’t succeed to access the information that I want, here is my code : The output of this code is that : and what I want is the second ‘p’ with the information : ’10. March 2021′ however I don’t kn…
How to label points in a scatter plot using zip and annotate
I am trying to use the zip and annotate in order to add labels in a vector tlab to a plot made using matplotlib. Instead, whilst trying to add the labels to the plot I get the error TypeError: unsupported format string passed to list.format How can I get the points on the plot using this method? code: In my
Seedable CSPRNG for python?
With the random module, you are able to seed it to get the same values every time. Is there a CSPRNG that can do this? For example, according to this question How can I create a random number that is cryptographically secure in python?, random.SystemRandom is secure. But seeding it doesn’t return the sa…
bs4 p tags returning as None
// scraping link from title, then opening that link and trying to scrape the whole article, very new to this so I don’t know what to do! Answer On some pages the <p> tags are not under an <article>, and therefor is returning None. Instead, to scrape all the paragraphs (and <li> tags if…
How to look for specific values in a dictionary and return them properly
So I have a list dictionary of dictionaries (lst) that I’m trying to iterate through, compare values, and return the appropriate values. I have the following code to retrieve 2 arguments given from the command line, compare them through the dictionaries entries, and return the appropriate value: get_att…