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
-
0
votes0
answers124
viewsProgram uses the threading module but I didn’t notice any parallelism in the execution. What’s wrong?
I made a script to decrease the quality of some mp3, calling the ffmpeg program through the subprocess module. I added Threads thinking of doing the process in parallel to multiple files at the same…
-
0
votes1
answer100
viewsvector<double> using ctypes for DLL in Python
I own a .dll that within it has a function BOLHA that returns a double. The problem is that BOLHA has a vector<double> in the argument. extern "C" minhaDLL_API double…
-
0
votes1
answer181
viewsPython strip() function malfunction
I have a list in a file, where each line has a user agent (with " at the beginning and end of each line), which is used in a later part of a program, to perform automated tests using Selenium. When…
-
0
votes1
answer71
viewsHow to generate lists named after an item from another list?
It is a program that reads Excel spreadsheet with debit and credit releases on an account. abreexcel2.py def leplanilha(): wb1 = oxl.load_workbook('extratomar2018.xlsx') folhas=wb1.get_sheet_names()…
-
0
votes1
answer137
viewsVertical table Flask template
I’m a beginner in flask and on the front end I have a table that it returns me information from an API, only instead of it throwing information on the table vertically it’s going horizontal, as I do…
-
0
votes1
answer1902
viewsProgress Bar - Tkinter
While processing takes place, the screen has to display a progress bar pro user. What is the logic behind this (Python, Tkinter)? How to make the progress bar appear on the screen while processing…
-
0
votes1
answer254
viewsGet dynamically created Checkbox values
Developing a python application using the Flask framework for simple registration I have the following problem, I have a register of bids and these bids can have several categories, the categories…
-
0
votes1
answer62
viewsAdd historical
I have the dataset called Gd, taken from an xls, an example: DATA_CRIA FROTA 1971 2 1972 19 1973 19 This dataset has several entries with the pattern listed above, I would like to create a…
pythonasked 6 years, 6 months ago user9080886 21 -
0
votes2
answers136
viewsHow to transform a list [['a'], ['b']] into a string: ab
quantidade = int(input()) lista = [] lista2 = [] lista3 = [] palavra =() i = 0 while quantidade != len(lista): a = input() lista.append(a) for x in lista: b = x.split() lista2.append(b) for x in…
-
0
votes1
answer6588
viewsprogram asking for the name and date (year, month and day) of a person’s birth in Python
Hello, I am having difficulties in the following code in Python:. The idea is to create a program that asks for the name and date (year, month and day) of birth of a person. The program must also…
pythonasked 6 years, 11 months ago Joao Peixoto Fernandes 111 -
0
votes1
answer65
viewsHow to use indices of two arrays to form a third array?
Basically what I want to do is C[i][j] = B[A[i][j]][i]. In the case A and B are 2 arrays 5x5. A formula é C[i,j] = B[A[i][j]][i] that is, C is the value of B[X][i], where X is the value of A[i][j].…
-
0
votes5
answers1043
viewsMatrix Nxm (2D) in Python with Numpy
I’m trying to solve a college activity, but I couldn’t transpose the logic into the code. The case is as follows: "The user will enter two integers. These integers will determine the size of the…
-
0
votes1
answer1226
viewsPython Indexerror: list index out of range
I downloaded this Python code here: # -*- coding: utf-8 -*- from sys import exit from json import loads from Tkinter import * from time import sleep from math import floor from random import randint…
-
0
votes1
answer30
viewsFile corrupts while trying to copy it
I was trying to copy a file using Python, but the file corrupts... Look at the code: #!/usr/bin/env python cf = raw_input("File: ") ds = raw_input("Destino: ") with open(cf,"rb") as fl: for l in…
-
0
votes1
answer993
viewsGet a certain column from a file with multiple columns
Personal I have a text file with some information separated by ';' for each example line: Nome;Email;Telefone;Endereço;Civil I need to 'filter' only the 3 field (Address because it starts from 0) of…
pythonasked 6 years, 6 months ago user68537 -
0
votes2
answers997
viewsHow to open a screen with a pre-filled HTML form?
I would like to know, how to open a form whose fields are already pre-filled with the user’s data (resulting from a search in the database), being in charge of it only edit the information. I’m…
-
0
votes1
answer216
viewsError installing Python library
I have python 2.7.14 installed with Pip 9.0.1 on a Macbook. I was experiencing an error trying to run Pip.list from the terminal. I checked on Google that I needed to edit the Pip.conf file, but I…
-
0
votes1
answer306
viewsError in requests with aiohttp in asyncio
import time import urllib.request import asyncio import aiohttp URL = 'https://api.github.com/events' MAX_CLIENTS = 10 def fetch_sync(pid): print('Fetch sync process {} started'.format(pid)) start =…
-
0
votes3
answers781
viewsPython Help: Exercise School Year
Hello, I am in need of help for an exercise in Python which is as follows: Exercise School year • Write a program that asks for the name and date (year, month and day) of birth of a person. • The…
pythonasked 6 years, 11 months ago Joao Peixoto Fernandes 111 -
0
votes1
answer112
viewsIs there a list of objects when sending requests in html?
I’m developing a small web project in python(flask) for my own learning and came across something that I had never faced before. I have a registration form where the fields of an information are…
-
0
votes1
answer105
viewsAPI WEB error with flask
I started my WEB API study trying to create a Pokedex API, When I tried to create the function of searching for Pokemon by number the following error appeared: "json.decoder.Jsondecodeerror:…
-
0
votes1
answer39
viewsNameerror when entering the value read by the input function
I’m running version 2.7 of Python: Python 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609] on linux2 When I try to spin that code line: x = input('Enter your name:') print('Hello, ' + x)…
-
0
votes2
answers1350
viewsIs there any way to receive email through php or in some other programming language?
Good afternoon to all, I’m not a professional developer, I know that in php there are ways to send email through phpmailer(), I wonder if there is any way to receive an email through public domain…
-
0
votes1
answer305
viewsSearch for sub-strings Python 3.xx
How to find Substring Occurrences in a string in Python. I need to do in hand this is my difficulty, I have to go through the string and if I find two occurrences of substring equal I have to remove…
-
0
votes1
answer985
viewsHow to create dataframe in pandas from series with dictionaries?
In Python3 and pandas I have a series with lists. In each row of the series there is a list, with dictionaries inside. It was obtained from a file: import pandas as pd geral =…
-
0
votes2
answers111
viewsList in HTML table separated by category
I am in a development using Python and Django and as IDE pycharm. I have a list coming via Rest by mobile, with the name 'Athletes', and comes with the columns "name", "category", "time". I would…
-
0
votes1
answer21
viewsHow to call a second key in a dictionary using Hdf5matrix?
I’m trying to upload a file .h5 using this documentation HDF5Matrix: test_images = HDF5Matrix(train_path+train_file,'images') but I’m getting this mistake: Keyerror: "Unable to open Object (Object…
-
0
votes2
answers214
viewsCount trading amounts performed with python replace
I need a code help, I need to count how many changes were made in the sentence, you have some idea to pass me.this code is to remove repeat substrings that are at the end of the sentence, now I need…
-
0
votes2
answers121
viewsSyntax error in basic Python 3 calculator
I was to program a basic calculator (add, divide, multiply, divide absolutely, find the rest of the division and power). The code is this : operando_1=input() operando=input() operando_2=input()…
-
0
votes3
answers2911
viewsHow to assign 3 values to 3 variables in only one python input line?
# Esse é um programa que você irá digitar 3 pontuações e ele irá te informar o vice campeão (ou segundo lugar) # Existe algum método de atribuir o valor de a, b e c em apenas uma linha na entrada? #…
pythonasked 6 years, 10 months ago Gustavo Matias 77 -
0
votes1
answer122
viewsKeras: Valueerror: Dimension 0 in Both shapes must be Equal (Vggnets)
I’m following a tutorial and loaded modelo VGGNet16 pre-trained using Keras vgg16_model = keras.applications.vgg16.VGG16() model = Sequential() for layer in vgg16_model.layers: model.add(layer)…
-
0
votes1
answer799
viewsReplace in list
I need some help with the code. def corrigePalavra(str): palavra = [str[-1:], str[-2:], str[-3:], str[-4:]] result = str palavra_modificada = False for w in palavra: if result.count(w) > 1:…
-
0
votes1
answer71
viewsProblems with Decode and Arduino
Hello, People I have the following code on Arduino if((digitalRead(4) != 1)||(digitalRead(5) != 1)) { Serial.print("\t"); Serial.print(analogRead(A0)); Serial.print(","); Serial.print(millis());…
-
0
votes2
answers75
viewsProgram that gives a secret number using bisection search
Create a program that gives a secret number using bisection search ! The user thinks of an integer between 0 (inclusive) and 100 (not included). The computer, using bisection search, gives a guess…
-
0
votes1
answer1013
viewsHow to fit the geckodriver for use of Selenium?
In Python 3 and Ubuntu, I want to run a test with Selenium: from selenium import webdriver from selenium.webdriver.firefox.firefox_binary import FirefoxBinary from time import sleep binary =…
-
0
votes1
answer142
viewsAssignment of lists in a matrix
I am creating in a sequence of files with the glob: list(glob.Glo('files')) Arrays with certain values taken from each cell of a file read as a table os.chdir('C: *2018-01-17') for file in…
pythonasked 6 years, 10 months ago Murilo Fretta 1 -
0
votes2
answers124
viewsHttpresponse not returning anything
Next, I’m having trouble with that message.. Which could be? Follow my code!! I’m trying to access "page" and this message comes up..…
pythonasked 6 years, 6 months ago duardoalmeida 23 -
0
votes0
answers57
viewsPython - about asyncio
I started testing pynput with asyncio, but there’s one problem I can’t solve at all. My code: current = set() def on_press(key): if key == keyboard.Key.up: current.add(key) print('Y') if key ==…
-
0
votes2
answers3216
viewsCrud with Python
What would be the problem with these codes? Someone could guide me which is the best practice to make a system of registration, editing, exclusion and consultation? First code: class Cadastro: def…
-
0
votes2
answers6769
viewsConvert pandas data frame to array
I have a data that, from . txt, I converted to a Dataframe (DF) with pandas. For the various activities I performed it is very convenient to be a DF. There is only one column with values, beyond the…
-
0
votes2
answers3405
viewsPython, value percentage (result)
is the following I need to make the program show the percentage of votes, only if I start the variable with zero does not give, because the program says that division by zero does not give, but if I…
-
0
votes1
answer139
viewsHow to make a function that picks up data and drops in bot chat
Good afternoon I have a bot for a site where I frequent and wanted to develop a function where it sends a private message in the system. In my head it seems simple but I can not execute (I know the…
-
0
votes1
answer63
viewsHow to import files using REGEX?
Good afternoon Everybody, all right? I have a question in regex in python. I want to create a script to open files without informing its format may be pdf, txt, jpg, png, among others... However, I…
-
0
votes2
answers106
viewsFunction that determines whether all letters contained in one string are in the other
def isWordGuessed(secretWord, lettersGuessed): ''' secretWord: string, the word the user is guessing lettersGuessed: list, what letters have been guessed so far returns: boolean, True if all the…
-
0
votes1
answer272
viewsHow to replace a certain sentence of a Python string? Using re.sub()
I would like to replace every expression that starts with characters: *:. tentativa = 'Olá td bem? *:palavra_proibida*985 td otimo' resultado = re.sub('*:', '', tentativa) Result Obtained: Olá td…
-
0
votes1
answer25
viewsOrganize tabs in pyqt4
Good afternoon, you guys! What command do I use to "break" the line of tabs? I would like 3 tabs to appear on a line and 3 tabs just below it. The skeleton I have regarding tabs is: # layout tab…
-
0
votes1
answer136
viewserror in the path to bank connection
I’m trying to add this path to the connection to the bank, and it gives me this error: File "C:/Users/gabri/PycharmProjects/allbd_s/conc.py", line 4 path='C:\Usuario\gabri\SQLite\conx' ^…
-
0
votes0
answers248
viewsIf and Else in Python Commands
How do I check whether a command has been typed correctly or not? For example, if the user enters a command that does not exist, it will display a warning message, otherwise it will execute the…
-
0
votes1
answer262
viewsTkinter locking into function
I am making a mini-program to be used in the working hours/study style the Pomodoro method. I made it very simple, fast, but when I press to start, the program hangs exactly the time that was put…
-
0
votes1
answer49
viewsPython - Doubt about imports in the creation of libraries
If I’m creating a library, and I put in it import json, in my main (my main file) I would have to import the json or just import from my own library? Thanks for your help.…