This is the first time I’ve really sat down and tried python 3, and seem to be failing miserably. I have the following two files: test.py config.py config.py has a few functions defined in it as well as a few variables. I’ve stripped it down to the following: config.py test.py I also have an __init__.py However, I’m getting the following
Tag: python-3.x
PIL Drawing a semi-transparent square overlay on image
This is giving me a giant black square. I want it to be a semi transparent black square with a cat. Any Ideas? Answer Sorry, the comment I made about it being a bug was incorrect, so… You can do it by creating a temporary image and using Image.alpha_composite() as shown in the code below. Note that it supports semi-transparent
How to make future calls and wait until complete with Python?
I have the following code where I have a list of usernames and I try and check if the users are in a specific Windows Usergroup using net user domain | find somegroup. The problem is that I run that command for about 8 usergroups per username and it is slow. I would like to send off these calls using
How to create our own linux command for python code file
I am new to python. As a part of my project, I am trying to create a linux command for the python file which I have already. For example I have a python file example.py, Here I am trying to make a command like $example –print file.txt . Which means I am giving the input file from the command itself.
How can I read a range(‘A5:B10’) and place these values into a dataframe using openpyxl
Being able to define the ranges in a manner similar to excel, i.e. ‘A5:B10’ is important to what I need so reading the entire sheet to a dataframe isn’t very useful. So what I need to do is read the values from multiple ranges in the Excel sheet to multiple different dataframes. or I have searched but either I have
Explicitly Define Datatype in Python Function
I want to define 2 variables in python function and define them as float explicitly. However, when i tried to define them in the function parameter, it’s showing syntax error. Please help me get the desired output. Here is the code: Answer Python is a strongly-typed dynamic language, which associates types with values, not names. If you want to force
Historical ethereum prices – Coinbase API
Using the python coinbase API– The functions– get_buy_price, get_sell_price, get_spot_price, get_historical_data, etc… all seem to return bitcoin prices only. Is there a way of querying Ethereum prices? It would seem that currency_pair = ‘BTC-USD’ could be changed to something akin to currency_pair = ‘ETH-USD’ although this has no effect. I would expect that the API simply doesn’t support this, except
Think Python 2nd Edition Exercise 7-1
“Square Roots” loop: Copy the loop from “Square Roots” and encapsulate it in a function called mysqrt that takes a as a parameter, chooses a reasonable value of x, and returns an estimate of the square root of a. To test it, write a function named test_square_root that prints a table like this: Here’s what I wrote: Here’s what I
create a list of all the subsets of a given list in python 3.x
how can I create a list of all the subsets of a given list in python 3.x? the list given be like [1,2,3] and i want an output like Answer You can use itertools.combinations to get the combinations: combining with list comprehension, you will get what you want:
How to tell if Python module is a namespace module
In Python 3, modules can be namespace modules without an __init__.py (as per PEP 420) or as a regular module (i.e. ‘[modules] packages as they are implemented in Python 3.2 and earlier’ – PEP 420) that have an __init__.py or are a single .py file. How can you tell the difference between a namespace module and an ‘ordinary’ module? (I