Category "python-3.x"

In MacOS, the webbrowser open function not return

I want to open a web browser tab with this simple python script: import webbrowser print('About to open') webbrowser.open('http://google.fr') print('Opened')

How to convert the dummy variable columns in to several columns?

I know how to unstack rows into columns, but how to deal with the following dataframe? date dummy avg lable 1-19 1 20 l1 1-19 0 40 l1 1-27 1 100 l2 1-27 0 140

Adding non-integer member values to IntEnum in Python3

I have roughly the following: class Foo(IntEnum): a = 0 b = auto() c = auto() strings = ["Alpha", "Beta", "Charlie"] def __str__(self): return Foo

python - lock process queue while queue.put() for n seconds

I have the following code (simplified): from multiprocessing import Process, Queue def f1(queue): while True: # do some stuff and get a variable ca

Enter names, display them as a list and print only the names that start with letter A from list

def make_list(number): names=[] for item in range (number): names.append(input("Enter your name with a capital letter.")) print(names)

Tensorflow ImportError: invalid ELF header

python version:3.6.9 and 64-bit At the beginning, i can't download tensorflow ,i use pip install tensorflow,then it throw error ERROR: Could not find a version

What's the difference between `raw_input()` and `input()` in Python 3?

What is the difference between raw_input() and input() in Python 3?

Should you always add list.copy() / dict.copy() when passing a list/dict to a function?

I had a painful experience today that I accidentally passed a list to a function, and took me ages to debug. The function was meant to take in a list and create

I want to make separated file for telegram bot every commands in python

pytelegrambotapii am making a telegram bot and i want to make every command in separated files i tried to do with this code from run_start import * @bot.message

How do I retrieve data from my JSON file uploaded on Heroku (discord.py) [duplicate]

I am only using JSON file for database in discord.py. The problem is, when I am deploying new update to my bot, my old JSON data is overwritte

How to create a dual-stack (v4+v6) python UDP server?

By searching for 'python dual-stack', I found https://bugs.python.org/issue25667 where someone mentions that this was already resolved in https://bugs.python.or

Modifying overlapping time period to include 1 day difference

I am trying to modify the overlapping time period problem so that if there is 1 day difference between dates, it should still be counted as an overlap. As long

Leetcode Reverse String problem not accepting in-place solution

I am posting two solutions below which I tried in leetcode for the problem no : 344 https://leetcode.com/problems/reverse-string/ Solution 1 class Solution: def

Exception occurs while importing wx on M1 machine

I installed wxPython version 4.1.1 from pip3 and my python version is 3.8.9 on a M1 processor running MacOS Monterey. Importing wx results in the following exce

iexfinance.utils.exceptions.ImmediateDeprecationError: get_available_symbols has been immediately deprecated. What's it been replaced by?

iexfinance.utils.exceptions.ImmediateDeprecationError: get_available_symbols has been immediately deprecated. Going over some python 3.7 code and after updating

Parsing JSON from POST request using Python and FastAPI

I'm trying to parse a JSON that came from a POST request from user to my API made with FastAPI. I have a nested JSON that can receive multiple values and my pro

Grouping keys and values with Python

I have some data. numeric key and numeric value: [ (468793398, 672), (468793398, 2464), (521683990, 131152) ] I need to group keys and

Why does returned object not get attributes & methods of the class after __new__?

Index objects of diskcahe have the property _cache with Cache object inside it. Cache is created with few arguments from those in Index. Unfortunately, it can t

Regex to find numbers that are not in a phrase

If I have e.g. this string: Beschreibung Menge VK-Preis MwSt% Betrag Schadenbewertunginkl.Restwertermittlung 1 25,00€ 19 25,00€ Rechnungsbetragexcl.Mw

how to use python variables in bash script inside python script

I am trying to use my python variables inside the bash script in the python script as below... import os import submodule URL="http://wmqa.blob.core.windows.net