How to skip waiting for winsound to end?

Every time winsound is played python waits until audio ends. My goal is to play sound via winsound and continue while sound is still playing. Is there a workaround? >Solution : Using multiple threads as @xihtyM mentions is not necessary. The documentation describes several flags for the method winsound.PlaySound. The one you are looking for… Read More How to skip waiting for winsound to end?

How to iterate through values in a dictionary

def countries(countries_dict): result = " " # Complete the for loop to iterate through the key and value items # in the dictionary. for keys in countries_dict.values(): for i in range(1,4): result += str(keys) return result print(countries({"Africa": ["Kenya", "Egypt", "Nigeria"], "Asia":["China", "India", "Thailand"], "South America": ["Ecuador", "Bolivia", "Brazil"]})) # Should print: # [‘Kenya’, ‘Egypt’, ‘Nigeria’]… Read More How to iterate through values in a dictionary

How to add parameters to url in python

Hello i have this code in javascript i have made where i give parameters in the url this is the javascript code: let user_id = ‘1234567890’; var chat_id = [‘@test1′,’@test2’]; url: `https://api.telegram.org/bot1234567890/banChatMember?chat_id=${chat_id[i]}&user_id=${user_id}` This code works great the paramets pass, my question is if it is possible to do something like this in python i saw… Read More How to add parameters to url in python

How to prevent filling up memory when hashing large files with xxhash?

I’m trying to calculate xxhash of video files using the following code: def get_hash(file): with open(file, ‘rb’) as input_file: return xxhash.xxh3_64(input_file.read()).hexdigest() Some of the files are larger than the amount of RAM on the machine. When hashing those files, the memory fills up, followed by swap filling up, at which point the process gets killed… Read More How to prevent filling up memory when hashing large files with xxhash?