Category "python"

lines repeat in List python

I need your help with the next problem, i need that a python recieve an string "EEEEDDSGES" and the output would by the sum of charactes that repeat in line, E

python code not understand. Step by Step explanation of this code

a,b=1,2 a,b=b,a=a,b print(a,b) # 2 1 If someone could give me a line by line explanation of this code, help me plz

Return the string having repetitive substrings consecutively more than x times

I’d like to get the string having repetitive substrings consecutively more than x times. The substrings has more than y characters. For example, when x=4,

python - write to txt file. the problem: some file names are ok, some file names get error

for example: testdata.txt - is fine datatest.txt - fail it happens with a lot of file names, some names are just fine a lot of other names fail. examples on scr

del builtin not functioning on list

So I'm trying to create a program that deletes the cells in jupyter notebook that are code cells and delete go into the cells that have the word solution and re

How can I plot specific Excel data from two columns with conditions?

I have a huge spreadsheet of data that looks something like this: Date IDNumber Item 2021-05-10 1 Apple 2021-05-10 1 Orange 2021-05-10 2 Apple 2021-05-10 2 Gra

Is it possible to add a if condition inside tal:define?

I'm using python with Zope and I'm trying to create a variable with a if condition (if possible). I'm having a difficult time finding examples and resources onl

Catching SyntaxError from ast.literal_eval

I have the following code to evaluate some configuration values stored in a file: from ast import literal_eval for key, value in dict_read_from_file.items():

Matplotlib: Transformation of coordinates

I've been struggling with this issue for a while now. I simply want to transform my data in display world, perform some operations, and then translate back to t

Select subset of test cases from all possible combinations

Let's say I'm writing a lifespan prediction calculator that takes in ~40 inputs: sex = ['Male', 'Female'] smoking_status = [True, False] ... Eventually, there

Generate github personal access token (PAT) by command line or SDK

I am looking for the command or SDK, such as python, to generate new personal access token (PAT) in Github, but I didn't see any API for it. https://docs.github

Branching in Pyscipopt

Branching on t_x21 led to this error [scip_branch.c:1061] ERROR: cannot branch on variable <t_x21> with fixed domain [-0,0] So, my guess as to why this

How to remove "- Swagger UI" from HTML Page title of OpenAPI docs in FastAPI

I am trying to customize my OpenAPI (Swagger UI) docs generated by FastAPI, but that string - Swagger UI still remains. app = FastAPI( title="Test", ver

Create view to save data in django m2m parent and intermediate (through) table using a form and formset

I want to replicate the admin functionality shown in the screenshot below on the client side. This is app is meant to cost a recipe based on the ingredients and

(python plotly 5.7.0) It doesn't display graph when ther's NO INTERNET, it still required internet to show graphs

I'm using python 3.6.8 and plotly 5.7.0 [user1@testsrv1 ~]$ python3 --version Python 3.6.8 [user1@testsrv1 ~]$ pip3 freeze | grep -i plotly plotly==5.7.0 [user1

Set Colorbar Range in matplotlib

I have the following code: import matplotlib.pyplot as plt cdict = { 'red' : ( (0.0, 0.25, .25), (0.02, .59, .59), (1., 1., 1.)), 'green': ( (0.0, 0.0,

Django aggregation Many To Many into list of dict

It's been hours since I tried to perform this operation but I couldn't figure it out. Let's say I have a Django project with two classes like these: from django

How to send URL of video from one html file to another using flask

Trying to create a simple website consisting of two webpages Few radio buttons to choose which input/output video to display Displays input and output video mai

Using python code typed with ParamSpec on older versions of Python

So, I was writing an event emitter class using Python. Code currently looks like this: from typing import Callable, Generic, ParamSpec P = ParamSpec('P') clas

Python's Paramiko gets stuck sometimes when verifying credentials - log file stuck at [chan 0] Unhandled channel request "[email protected]"

I'm using the Paramiko Python module to connect to a remote server as user admin and then switch user to root. here is the class I'm using class ShellHandler: