Skip to content

Tag: python

If I use a helping function for a discord.py command, should I use await to call my helping function or just transfer control to my async helper

I have a command that works to send multiple type of messages that follow the same structure but I am using a helping function to send the message. For simplicity, my code looks similar to this: Option 1: Option 2 is making every function async and calling helper with await. It is my first time creating a dis…

Logger not creating logs on log file in flask application;

I want to create logs in my log file, logs can be shown on the terminal but not written on the log files. I created a package imp_calc which has templates and other files inside it, accessing it using run.py which accesses the imp_calc package’s modules. My folder structure is as follows: my init.py fil…

Generating 2D matrix in python with all the elements is 0

I’m making a game in python. The map of the game is a stored as matrix with number of line and column are equal, the matrix look kind of like this: I want to make a matrix generator to store it in ram when the game is openned in stead of store the whole matrix like that in the game

Unable to send sms on whatapp throguht route

bascially i am making a route in which i have connect my api of whatapp when i send a number in my json response thought software this route should send me a whatapp message on that number this is my request body: { } Answer You aren’t formatting your API request URL. The variables can’t be passed…

Reading binary lines not matching file lines after first line

I’m trying to read and print the binary data of a file but notice after reading the first line, with 128 bits, the subsequent lines printed out do not match the lines when I look at the binary data manually with notepad++. Answer The problem is that when dc==16 then your program prints whole line but th…

Iterate and Parse Json with similar values in python

I have this code which iterates and parses data from a json API feed. I am trying to filter out just the Premier League games but some competitions have similar names like ‘Premier League 2 (Division 2)’ and ‘Premier League Cup’ the output for this code is below. As you can see the fir…