I have a question regarding the following exercise: In this function, I print lastrecord.fetchall()[0][0] and quantity.get to make sure they are float. So the program prints in that case: 5.0 for lastrecord.fetchall and quantity.get Up to now, no problem, but when I try to us them up, it gives me an error of List Index Out Of Range, so program
Tag: python-3.x
How to get a GCP identity-token programmatically with python
What is the python programmatic alternative to the gcloud command line gcloud auth print-identity-token? I am trying to invoke Google Cloud Function by http trigger (only for auth users) and i need to pass the identity token in the Authentication header. I have method which works great when i run the code on GCP app engine. However, i struggle to
Am I using the on_guild_leave function correctly?
So I looked at many sources saying that on_guild_leave is how it is used, but I can’t get it to work. Here is my code: Can anyone seem to help? on_guild_join works, but on_guild_leave doesn’t. Answer on_guild_leave doesn’t exist, use on_guild_remove instead. Docs for on_guild_remove
How to find the maxValue’s line number in one loop?
here’s the code: Tips how to simplify the code are welcome I would like to find a position of the line that contains the max value(already found that value) I know i can just use another loop to find the placement, but i wonder if there’s a shorter and more efficient way to do it Answer There’s a method to
How to obtain a value from inside a loop
I will be implementing multiprocessing so that the loops are occurring at the same time, but how can I make it so at the end of each iteration, I can obtain the value of westernEurope.cases and easternEurope.cases so that I can add them together Answer IMHO there is no need for multiprocessing. With a generator, your problem can be solved
How to replace equal consecutive numbers in a list to nan?
I’m trying to replace equal consecutive numbers in a list to nan. I having problems to replace all values when there is a odd number of equal consecutive numbers. This is my code, very simple: Another question, if I want to replace only those values that repeated more than 3 times, for example the numbers 1 or 2 that are
Pytest: Nested use of request fixture
I’d like to get some help on how to run pytests with multiple layers of parameterized pytest fixtures. I have a global request-based fixture for selecting a base implementation of the system I’d like to test: I’d like to now run some additionally-parametrized tests against different test cases on the backend. Using these two layers of fixtures, I’d like to
search by subproces in dir and return non-zero error
i want to make a program to search all my pc and make list of result , so first of all i can not search all partition together and have to use os.chdir(“”) on the other hand when some Suffix dose not exit in it make a error and stop program. My code: And result: What sould i do to
All unique combinations of a set of sets of values
If I have an arbitrary amount of elements, each with a specified set of values, what can I do to get all possible combinations with a value from each element’s set? For example, let’s say I have: What can I do to get the following? Input/output don’t need to use dicts, but I figured that’s the easiest way to represent
How do I use colorama inside a tuple?
I’m trying to change individual existing lines inside an existing tuple. Example: I want ID to be one color, Name, Age, Condition, Medicine, Temperament, and Adoptable to be a different color. I can’t figure out how to enter the escape codes for color inside the existing tuple. Help! Answer You need to prepend Fore.<COLOR> and preferably append Style.RESET_ALL to every