Most voted "python" questions
Python is a dynamic and heavily typed programming language whose design philosophy emphasizes usability. Two similar but incompatible versions of Python are in use (2 and 3). Please mention the version you are using when asking a question about Python.
Learn more…8,642 questions
Sort by count of
-
-1
votes2
answers236
viewsRelationship with Admin Django
I am a beginner with Python and Django and I am doing a menu Enerico, I would like to know how to list in Django Admin the items related to a menu in Modeladmin Menu class Menu(models.Model): menu =…
-
-1
votes1
answer71
viewsHow to get a correct value using the point?
preco_casa = float (input("Qual o preço do imóvel?")) seu_salario = input("Qual o seu salário mensal?:") anos_a_pagar = input("Quantidade de anos a pagar pelo imóvel:") valor_prestacao = preco_casa…
-
-1
votes1
answer861
viewsThe browser displays my python code instead of running it
When accessing through the browser my Python page, it displays the code and does not execute the script. Follows my code: #!/usr/bin/python # cabecalho que informa o browser para renderizar como…
-
-1
votes1
answer76
viewsHow do I fix this error when I import requests?
python3.2/site-packages/requests/__init__.py", line 84, in <module> from urllib3.contrib import pyopenssl File…
-
-1
votes1
answer1474
viewsIs it possible to generate log files from a Python file that has been transformed into an executable?
Hello, I create the Python code executable below with the module pyinstaller. import urllib import urllib2 import webbrowser import re import popular4 import logging from datetime import datetime…
-
-1
votes1
answer429
viewsFinding percentage in repeated numbers - Python - Statistics
Good morning, you guys. I need to solve a statistical problem. But I’m having trouble finding the percentage of the clustered numbers that repeat. Can someone help me? Thanks in advance, follow…
pythonasked 7 years, 4 months ago Andre Batista 41 -
-1
votes1
answer4942
viewsPython/Pandas - How to create a "str" column from another numeric, including zero on the left when the value is less than 9
The code I used to create the column is returning with the following error: The Truth value of a Series is ambiguous. Use a.Empty, a.bool(), a. item(), a.any() or a.all(). I don’t know how to fix…
-
-1
votes3
answers646
viewsPYTHON FUNCTION(METHOD)
Well I am trying to create a register program in python, but a simple one only to test what I have learned, but I have a problem, I created a function and I return and then store in a variable but…
-
-1
votes1
answer1228
viewsRead fasta files in python and skip the first line
I need to read a file boredom, but I don’t know how to eliminate the first line of the sequence, example: >sequence A ggtaagtcctctagtacaaacacccccaatattgtgatataattaaaattatattcatat…
-
-1
votes2
answers2386
viewsError installing pyaudio and pocketsphinx
When I type sudo pip install pyaudio this error message appears, I already googled but I can’t find a solution: Command "/usr/bin/python3.6 -u -c "import setuptools,…
-
-1
votes1
answer289
viewsConsultation in public database
I need to perform queries in an online database, and turn the returned data into a data frame. I used an existing example on the database website, but I have no idea how to turn it into a database.…
-
-1
votes1
answer1178
viewsReading an XML file and printing specific fields using the Python language
I have the following XML file (actually it’s just a piece of the file): <!DOCTYPE sysstat PUBLIC "DTD v2.19 sysstat //EN" "http://pagesperso-orange.fr/sebastien.godard/sysstat-2.19.dtd">…
-
-1
votes1
answer212
viewsProblem instantiating classes in Python 3
When I run my program test.py: the debug give it back Object() takes on Parameters '' on line 4 from tatu2 import Cliente from tatu2 import Conta joao = Cliente('João da Silva', '777-1234') maria =…
-
-1
votes3
answers773
viewsPandas does not find file
I am using pandas in Python to read a CSV file that is on my computer, however appears an error message, it seems that it does not find the file: import pandas as pd reclamacoes =…
-
-1
votes1
answer356
viewsHow do I list all the properties of an object?
I wanted to take only the properties of an object, and pass the value of each of these properties as an argument to a function.
pythonasked 7 years ago Matheus Silva Pinto 445 -
-1
votes1
answer82
viewsIdentifying members of the same family
would like to know what I can use in machine Learning or other type of tool for the following problem: I have a list of full names and I would like to identify among them which are related by the…
-
-1
votes1
answer1660
viewsHow to turn diagonal elements of a python matrix into a list
I have the following matrix, for example: matriz = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 3, 8, 9], [4, 5, 2, 3, 4, 4], [2, 3, 4, 5, 3, 6], [4, 5, 3, 4, 5, 6]] I would like to obtain only the elements of…
-
-1
votes1
answer36794
viewsHow do I place items on a list in ascending or descending order?
I am trying to put the numbers of a list in ascending order but the Sort() method is putting the 10 and its multiples (20, 30) as being similar to itself divided by 10. For example, in the following…
-
-1
votes4
answers747
viewsRegex in Python to find several possible names
I need to find the name of the judge in a file of labor process, but first I need to know if he is Judge(a), Rapporteur(a), Judge(a) Rapporteur(a) or Judge(a). I’m using the following Regex: f_regex…
-
-1
votes2
answers186
viewsDisplay items from a list in the Django html
My code is this:: {% for item in saldo %} {{item}} {% endfor %} And I would like to present the numbers (in the image), each in each row. Does anyone know how? I tried to do a "for" inside the…
-
-1
votes1
answer92
viewsGiven two IP’s is it possible to check if it comes from the same network?
I’m starting with Python now and I’m developing a project to find users with multiple accounts on a given site. The IP’s are already downloaded, but it remains to be able to verify if, comparing the…
-
-1
votes2
answers137
viewsRead files and automatically put in the desired line;
I have several files in one folder: 01.PNG, 02.PNG, 05.PNG, some of the files do not have (04.PNG, 03.PNG). What would be the easiest way to write a text document where each file name would be…
-
-1
votes1
answer2531
viewsDividing list items by a number
Hello! I am a student of astrophysics and need to know how to "normalize" an astropy function: blackbody_lambda(wavelenght, temperatureG) For this specific value: 1279894.374188775erg / (Angstrom…
pythonasked 6 years, 10 months ago Thâmise Rocha 1 -
-1
votes1
answer361
viewsFunction showing list in reverse order
def imprimeDeTrasParaFrente(lista): if lista == None : return imprimeDeTrasParaFrente(lista.proximo) print lista, class Node(object): def __init__(self, carga=None, proximo=None): self.carga = carga…
-
-1
votes1
answer26
viewsError "zero is not a supported Scheme"
I’m trying to use Couchdb together with Python, I did the installation of both correctly, I went to Couchdbe created a user, when I go to the Python compiler and run: import couchdb couch =…
-
-1
votes1
answer54
viewsWhy are the string characters being printed as integer numbers?
I have to analyze a code snippet and explain how it works, but I can’t figure out the output: Code: word_norm = 'mundo'.encode("utf8").lower() for idx, value in enumerate(word_norm): print(idx,…
-
-1
votes1
answer69
viewsDoubt about the Vscode
I’m doing an exercise whose code is this:: import random n1 = str(input ('Primeiro aluno:')) n2 = str(input ('Segundo aluno:')) n3 = str(input ('Terceiro aluno:')) n4 = str(input ('Quarto aluno:'))…
pythonasked 6 years, 9 months ago Marcos Wesley 3 -
-1
votes2
answers3992
viewsI can’t download pygame
Guys, I was trying to download the pygame by the pycharm but it keeps failing all the time, someone knows why? someone could help me?…
pythonasked 6 years, 9 months ago João Pajehu 7 -
-1
votes2
answers286
viewsDebug with Flask/Python
I’m studying the Flask framework. I happen to need thresh an object request with form data. I also need to stop at a certain point, like the die() in PHP. How do I do that? I’ve tried os.exit(1),…
-
-1
votes1
answer46
viewsString inside a model in python?
User enters with a string:'a123' I want the program to identify if this string is in the model a%d, where %d is any number. I need to identify the number too.
-
-1
votes1
answer1354
viewsHow do I get value from the first line of a Text(txt) file?
So... as you can see, the variable target sets the email that will be sent the message. However, I cannot add the value of the first line of the list.txt inside the variable target. The idea of a…
-
-1
votes1
answer3266
viewsWhy doesn’t Pycharm recognize the modules and classes created by the user?
Hello, I’m new to python and have recently started working with the Pycharm IDE Community version. About the IDE, I liked it a lot, one of the best IDE’s I’ve ever used. However one problem I…
-
-1
votes2
answers812
viewsHow do you capture two integers with space between them in python3?
I want to capture two integers, example: 2 4 exactly so in python, but it by int(input()) normal n goes, I have done so, but must have another way: var = input() lista = [] lista = var.split(' ')…
-
-1
votes1
answer916
viewsOrdering a list of strings in python
Staff need to sort a list that inside it there is another list containing exactly a string and a number, the problem is that I’m not getting the desired result, let’s put an example, if I have the…
-
-1
votes2
answers319
viewsPython URI error - 2588 - Palindromes
By going up my code to URI Online Judge (problem 2588), makes a mistake, and I’m not getting it right at all. The statement is this: And my code sent was this: entrada = input() letras_unicas =…
-
-1
votes0
answers267
viewscmd -> Pip -> "The system cannot run the specified program."
People how to solve this? windows 10-64bits and Python 3.6.5 (64-bit)…
-
-1
votes1
answer59
viewsDoes the "sudo" command work in Debian?
I tried to execute the sudo in python and returned me "bash: sudo: command not found", what’s the problem? I’m trying to use matplotlib and I’m not getting it, so I tried to install, running: sudo…
-
-1
votes1
answer534
viewsI wanted to make a magic square, where I put 9 numbers, and the sum of them has to result 15 (horizontal and vertical)
Good evening guys, I have this matrix: I need the matrix numbers summed all 15. Both vertical and horizontal.. Code: import numpy as np import random from tabulate import tabulate a =…
-
-1
votes1
answer66
viewsHow to scan data like google?
Good evening as I can make an application that basically works like google, I want to type a keyword and get results on, or pull data from google itself, which language and path should I use?
-
-1
votes4
answers26369
viewsFind certain text in a string
Hello I’m having a doubt. nome=str(input('Qual o seu nome completo?')) print('Seu nome tem Enzo?{}'.format('Enzo' in nome.lower())) I have this code that it checks without having a certain string…
-
-1
votes1
answer222
viewsManipulating dictionaries within other dictionaries
Alunos = { 111: { 'nome' : 'Joao', 'curso' : 'ADS' }, 222: { 'nome' : 'Pedro', 'curso' : 'SI' }, 333: { 'nome' : 'Maria', 'curso' : 'SI' } } I need to write a script to show the names of the…
pythonasked 6 years, 6 months ago Anderson Pissulin 1 -
-1
votes1
answer242
viewsDoubt with Python neighbor numbers
I wonder if someone could help me in this code in order to calculate neighboring numbers (numbers in common) in two arrays, but does not return output. i = 0 j = 0 k = 0 input1 = input() input2 =…
-
-1
votes2
answers885
viewsTypeerror: a bytes-like Object is required, not 'str'
I am trying to run an existing program. I have fixed some parts of this program that I think was developed for Vers. 2.x, but I’m trying to run it on 3.6.5. But I came across a line that I can’t…
-
-1
votes1
answer74
viewshow to make the system call return to the inverted string?
print('Listening on {} {}'.format(ip,porta)) (obj, cliente) = server.accept() print('connect received from {}'.format(cliente[0])) while (True): msg = obj.recv(1024) **system('rev')** server.close()…
pythonasked 6 years, 6 months ago eneias paulo 1 -
-1
votes1
answer93
viewsLanguage for Backend and another in Frontend?
I have a desktop program without GUI working in Python, I would like to add a GUI using another language mainly one with some visual editor ,C++ for example, to be a frontend, would that be…
pythonasked 6 years, 5 months ago FourZeroFive 1,231 -
-1
votes1
answer882
viewsMysql + Python (Save Variable Login To Connect)
import the import getpass import mysql. class Acessdatabase(): UserName = "" PassWard = "" DataBase = "" def LoginDB(self): self.UserName = input("Username: ") os.system("cls") self.PassWard =…
-
-1
votes1
answer178
viewsSort an alphanumeric list by number
For study purposes, I have the following problem: A list with grocery shopping with description and values , I need to order increasingly but without losing the description. Note: To order the items…
-
-1
votes1
answer33
viewsDoes not satisfy the condition with the value informed by the user
I made this code, but it does not enter the option informed by the user (I think the option already tells what he has to do). lista = [] while True: print("Adicionar nome - 1") print("Sair - 0")…
pythonasked 6 years, 4 months ago Nathan Silva 87 -
-1
votes1
answer6223
viewsHow to use quotation marks inside quotation marks and exchange words inside the argument?
Rotating the os.system("reg add "caminho\caminho\caminho\caminho\"") and if you can do more, you have a way for me to pick a word in the middle of that command and replace it with another??…
-
-1
votes1
answer43
viewsEnumeration and print error
In this list the combinations appear. But I can’t enumerate them. and when I printed the last sum total of 520. I don’t know what I’m doing wrong. from itertools import combinations lis = [25, 26,…
pythonasked 6 years, 4 months ago Peçanha De Oliveira Eduardo 1