Skip to content

Tag: python

Building a password generator

I have recently built a password generator but wanted to include an aspect where if the user types in a letter instead of a number when defining the length of the password and number of passwords then the output would be to loop back in. If not the password generator would continue if numbers were inputted. T…

Output is an empty file

My code does not throw an error, it simply creates the files, but of which are empty. I tried it from the command line, and it works using the wildcard training_set_pssm/*.pssm path, but I must do it from the IDE because it is not printing the correct output anyway. The input file is a set of checkpoint files…

Manim exception in text mobject example

I’m trying to run this example from Manim community documentation: For some reason I’m getting this error: I’m using the latest version of Manim community (0.14.0) What am I doing wrong? The full output is: Answer You could try to upgrade manimpango via pip install -U manimpango. As a workar…

Put comma after a pattern in python regex

Just like the question says I am trying to add a comma at the end of a pattern or sub string. I found 3 solutions that should do the job, and look logical too. But they are not changing anything. I will show you all those codes. The goal is to find out if there is something that I am

asdict() inside .format() in a Python class

How can I use asdict() method inside .format() in oder to unpack the class attributes. So that instead of this: I could write something like this: Answer asdict should be called on an instance of a class – self, in this case. Additionally, you don’t need the dict’s keys, you need its values,…

Django index unique on where

I have a class, which represents photos attached to a person. I want to make sure that for every person there could be only one main photo. In pure SQL i would use something like You can play with it here http://sqlfiddle.com/#!15/34dfe/4 How to express such constraint in django model? I am using django 4.0.1…