Questions tagged as 'python'

2
answers

how can I ask the user to enter two names and two last names, only letters

validacion='' lista=[] while validacion!=validacion: nombres = input('Ingrese nombres completos:') lista=nombres.split(" ") validacion=len(lista) if validacion==4 and nombres.isalpha(): print(nombres) print('¡Solo ingr...
asked by 31.05.2018 / 00:44
0
answers

Python total field [closed]

I have the following code: forms.py: MAX_DETALLES = 5 Detalle_VentaFormSet = inlineformset_factory( Venta, Detalle_Venta, fields=('cantidad','producto'), #SI AGREGO EN FIELDS SUBTOTAL, NO ME DEJA MOSTRAR EL FORM DIRECTA...
asked by 20.05.2016 / 01:31
2
answers

Problem urllib2 with HTTPS

I'm trying to retrieve a page on Flickr using urllib2 and I get the following error when I execute the command urllib2.urlopen('https://www.flickr.com') File "/usr/lib/python2.7/urllib2.py", line 104, in urlopen return _opener.open(...
asked by 21.04.2016 / 22:08
1
answer

Get audio from Youtube Live Streaming

Is there any way to get ONLY the url of the audio track of a live YouTube broadcast? I'm trying with the Pafy and Youtube-dl libraries but I only get mp4 files, there are no m4a files like in the rest of the videos. streams = video.audiostr...
asked by 04.07.2017 / 22:35
3
answers

Take a parameter in a url and send it to the model when a form is sent

I have a CreateView view to which I am passing a PK by the URL, what I want to do basically is to take that station and send it to a field of the model with which this view works (the form does not contain the model field to which I want...
asked by 18.07.2017 / 06:45
3
answers

Select positions of a vector. Python

I am translating from R studio to Python and I have a doubt, in R I am using which what what it does is give the indexes TRUE of a logical object, allowing the indexes of the array. For example, if I have a vector v=(0,5,6,7,81,...
asked by 01.08.2017 / 18:41
1
answer

Black screen when running Pygame

Previously to ask this question it is worth noting that I have consulted several sources looking for some answer to my problem. None of them seems to have served. Despite trying to solve my problem on my own, rereading the code, the error still...
asked by 01.02.2016 / 14:07
1
answer

Amazon EC2 error IOError Input / Output every 6 or 12 Hours

When I put my project in Amazon EC2, I happened to interact with my application in a moment the error of errno 5 input/output error django I found this ticket reported In my console it appeared to me that my server required to re...
asked by 06.01.2016 / 22:48
1
answer

Find complete words in a string that may or may not be surrounded by "_"

I'm passing two lists for a class DictionaryMaker() . This will generate a match between words of the item of one list with the item of the other, in order to declare each item as a key and value. The class and the method work for me, b...
asked by 28.06.2017 / 18:54
2
answers

How to avoid an error

I have a list with 2 elements a=[1,2] if I put for example [2] as it will mark > > Traceback (most recent call last): File "<pyshell#13>", line 1, in <module> > if a[2]== IndexError(): IndexError: list index o...
asked by 24.03.2018 / 19:57