Questions tagged as 'python'

2
answers

How can I create a field in a form without having to create it in a model?

I have a ModelForm in which I want to add a field without having to create it in the model, how can I do it? If you are wondering why I want to have a field in a form if I am not going to send it to the model, it is because I am going to take...
asked by 25.08.2017 / 02:57
1
answer

How to show number without commas in python

I have a question I have the following number 33,003,567.564 and I would like to convert this number to a number without commas but if with a decimal point it is: Get something like this: 33003567.564 And that this applies to any amo...
asked by 29.10.2018 / 03:27
2
answers

how to make a triangle with this symbol in python (*)?

1) My first problem is how to apply the math with the symbol (*) in str form. 2) My second problem is how do I make a triangle like this * ** *** **** ***** This is my code so far def triangulo(): simbolo='*' for i in range...
asked by 05.10.2018 / 06:14
3
answers

POO Python: 1 positional argument but 2 were given

I do an exercise in Python the intention is to move around a 5x5 space but I have an error in the simulation of a switch that they think is: class Robot(): def __init__(self, x, y): self.x = x self.y = y switcher...
asked by 28.08.2018 / 19:39
1
answer

Difference in concatenating data in Python 3.7

I thank in advance the people who can help me with this query, since I am new to programming. I am taking a python course and I was practicing the conditionals and the following question arose: Why when concatenating with commas do not give m...
asked by 06.12.2018 / 05:09
2
answers

Print abbreviated month in python

I have a problem, how can I print the name of the month abbreviated in python using datetime fecha= datetime.now() print(f"Fecha:{fecha.hour}:{fecha.minute} {fecha.day}/{fecha.month}/{fecha.year}"); input()     
asked by 03.12.2018 / 08:12
2
answers

Open and close a plot within a while

I'm trying to plot a signal with Matplotlib and the plot is within while . What I want is that every time I go through the while a graph is opened and then either immediately or after a time that I can control it will close. I have...
asked by 22.04.2016 / 10:19
1
answer

Cycle an arrangement of a MongoDB object in Python with Django

I'm trying to cycle an array that comes from a node in mongoDB, this is Mongo's object: { "nombre": "Sebastián Yatra", "paises":["México","Argentina","Perú"] } The view controller is this from django.shortcuts import render from pymon...
asked by 03.08.2018 / 22:02
2
answers

List of data. Python

Lists in Python I've been studying a bit and I have a doubt. I saw a video where the tutor gives an example of a list: year = [1950,1951,1952, ..., 2100] Enter the points (...) to follow up, but I get the error that it is not possible...
asked by 14.11.2016 / 03:16
3
answers

Format a list in Python?

I have the following list in Python, which can be changed according to the user's data: Dialer = [1,9,2,'.',1,6,8,'.',0,'.',2,6] When I print the list I get this:    [1, 9, 2, '.', 1, 6, 8, '.', 0, '.', 2, 6] How can I format the lis...
asked by 10.11.2016 / 01:46