I work on a project where we want to have multilingual site. We start with two languages defined in settings.py I am not the programmer doing the work but if I understood correctly all we need is to be able to add – for example – French language for the whole website but not via setting.py but Dja…
Tag: python
How do I pass user input as a string in an API request?
I am trying to take user input (zipCode) and pass that into an API request. How do I format the zipCode user input so that the GET request reads it as a string. As you can see above, I have tried to declare another variable that turns the zipCode into a string. Answer Firstly, function user_input() returns wh…
How to transform current date and use it as a parameter in function?
I want to create a script that run at a specific date everyday given the variable status as a parameter. The status can take two entries: “past” or “present”. I want to save the current date as a parameter and use it after in a function to make different calls. So the current time beco…
Convert instructions to op code bytes in python script for IDA Pro
I need to convert into op code bytes the instructions that I have disassembled but I can’t find a function that lets me do it, I’ve tried idc.get_bytes but it doesn’t seem to work. This is my python script: I’m using this script with the batch mode of IDA Pro 7.7sp1, can you suggest me…
(python) subtract value in a list from value in the same list in a for loop / list comprehension
suppose i have in a for loop I want to subtract the value i from the value that comes right after. In the above example: 4-3, 6-4, 8-6, 13-8. (and i want to skip the first value) desired result can i do this in a for loop / list comprehension? more specifically do I want to do this in a
Sorting lists with multiple tie breakers
I have data in an array like so: I want to sort it by the amount of non-10 values, and I also want to sort it in ascending order for rows, and in descending order of number of 10s: Output: I want to implement a tie breaker system so that if the amount of 10s the same, it now orders
using set() with pandas
May I ask you please if we can use set() to read the data in a specific column in pandas? For example, I have the following output from a DataFrame df1: where the first column is the index.. I tried first to isolate the second column using the following: x = pd.DataFrame(df1, coulmn=[0]) Then, I transposed th…
ValueError:Reshape your data either using array.reshape(-1, 1)if your data has a single feature or array.reshape(1, -1) if it contains a single sample
**the code predict the house price with polynomial regression model and fastapi **` make class have an one parameter and have a 4 value #The train_plynomial_model is a function that takes the Features and returns polynomial model The predict is a function that predict the house price “ I tried to put th…
Python change lowercase to uppercase
I need help with python program. I don’t know how to make python change at least 1 lowercase letter to uppercase. Answer You want a password with at least one uppercase letter but it shouldn’t be every character. First get length random lowercase letters. Then get some random indexes (min. 1, max.…
Using cophenetic distance to choose best linkage method?
I have the dataset that generates the following code. The case is that I would like to make a dendrogram (bottom-up) in Python and I must select a linkage criterion. If you consult the documentation of the function you can see the existing methods. https://docs.scipy.org/doc/scipy/reference/generated/scipy.cl…