Skip to content
Advertisement

import: command not found

I try to open .py file with MINGW64. File 1: myname.py File 2: hello.py: When I try to execute hello.py in MINGW64 shell, this error happens: how to fix it? I can’t find what’s wrong. Answer To run a Python script as a command, without using the “python” command, your first line has to tell the system what interpreter to

Pandas grouping by week

I have a data frame in pandas like this: I need to get the count of items by week. Example: From 9/6 to 9/13, the output should be: Similarly, I need to find the count on these intervals: 9/13 to 9/20, 9/20 to 9/27, and 9/27 to 10/4. Thank you! Answer May be with the caveat of the definition of

Look for complement of unicode range in python

I have a set of words and I want to find those who contain non italian characters. Instead of providing all the possible unicode ranges of letters not belonging to the italian alphabet, I think it would be much better to specify the ranges of the allowed letters and then check if a string contains any character not belonging to

python read a specific json

I’m trying to read this json. I need values: PoolID, PoolSystemCapacityGb2,NumPagesUsedPool, and others.. But i can only read values for the ‘PooID’:1, not for the PooID’:90 How can i parse this kind of json? My code: thanks for help. Answer If you need to get all objects from JSON with some specific key, you will need to traverse all elements.

Why this for doesnt fill the empty array? [closed]

Why this for doesnt fill the empty array? I get the msg NameError: name ‘arrayFinal’ is not defined def sortedSquaredArray(array): arrayFinal =[] for i in range (len(array)): squared = array[i]*…

Insert an item at the begining of linked list by Python3

How to modify the following code? so that the item can be inserted to the begining of a linked list with add()? why None shows up at the beginning of the linked list? is there anything wrong? I tried several times. It just does not work. What heppened? Any suggestions to change? Is ther any good suggestion when writing a

Advertisement