Questions tagged as 'python-3.x'

2
answers

How to install pip for a particular version of Python?

I have ubuntu 17.10 installed and it came with Python 2.7 and 3.6. I installed Python 3.4 but I can not install the pip on it, it always goes to the latest version with pip3 which is 3.6 How can I install 3.4?     
asked by 23.10.2017 / 18:49
2
answers

UnicodeDecodeError: 'utf-8'

I'm having UnicodeDecodeError: 'utf-8' problems in a python file and I'm not able to solve it. This is the error: Traceback (most recent call last): File "file.py", line 448, in <module> fileOriginal.sliceFile(url) #Separa os arqui...
asked by 23.05.2016 / 22:37
4
answers

Generate random values from a distribution in Python

Hello I'm trying to generate random values from a distribution (Gamma, normal and etc) in python, but I'm having trouble importing the library. I am using the following library "import scipy.special as sps", but it is giving error ... using b...
asked by 11.11.2015 / 19:24
1
answer

Sorting a list of objects by date [closed]

I have a list of objects and each object in that list has an attribute that is a date, in the same string format. How do I sort this list of objects by that date?     
asked by 10.10.2016 / 18:43
1
answer

Excel spreadsheet word search and full line return containing that word in PYTHON

Hello, is everything good? I am a beginner in Python and would like to run a script that given a spreadsheet in excel, the user could search for a word within that worksheet and if the word was found return "Found File and display all lines. For...
asked by 27.01.2016 / 14:50
0
answers

How to extract information from an HTTP header with Python?

We know that in the HTTP protocol, the end of the header is indicated by " \r\n\r\n ". Example: Forsomereason,theclientmaynotsendthe" \r\n\r\n " to the server (this could be an attack, for example): Suppose I have a netw...
asked by 01.09.2017 / 17:15
3
answers

Redeem only 10 first Python object records

I'm curled up in a part of the code I'm doing. I need to retrieve only the first 10 records of an object that I call in a for loop: listaTabela = [] for aluno in alunos: listaLinha = "" listaLinha += str(aluno.g...
asked by 18.07.2018 / 16:39
2
answers

Is there any way to download a Youtube video using urllib?

Is there any way to download a video on youtube using urllib in Python? I tested, but it does not work (just an example): import urllib.request youtube = "" pagina = urllib.request.urlopen(youtube) urllib.request.urlretrieve("",...
asked by 02.01.2017 / 16:45
2
answers

Why is the output coming out like this?

I'm trying to make a program in which I use a list and that program returns 2 lists one with the other pairs with the odd ones. lista = [0,1,2,3,4,5,6,7,8,9,10] def par(numero): if numero % 2 == 0: return numero def impar(numero):...
asked by 11.12.2016 / 23:12
3
answers

How could I improve the code?

Is there any way to improve this code? lista = [0,0,0,0,0] acuNota = 0 x = 0 arq = open("notas","w") while x <= 4: lista[x]= float(input("Insira uma nota por favor!")) acuNota = acuNota + lista[x] print ("Criando arquivo e...
asked by 07.08.2015 / 15:36