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
answers92
viewsDoes Python Command Exist Similar to (Catch and Throw) Ruby?
Exists in Python Similar to Ruby (Catch and Throw)? I’d like to jump like this: a = 10 throw :pularparaaqui if a == 10 catch :pularparaaqui do end
-
-1
votes1
answer174
viewsHow to generate a graph with distinct X and Y with the matplotlib module in Python?
The objective would be to generate a bar graph where the Y axis goes from 0 to 10 (fixed mode), and the user would inform the maximum value of X (the X axis being constituted of 1 until the informed…
-
-1
votes1
answer244
viewsCode Review: Program that simulates the "door game": either you win a car or a goat!
Write a program to simulate the door game. Make a program that has the output as the following: Hello, welcome to our program! Let’s see if you will win a car or not! Choose one door: 3 You chose…
-
-1
votes1
answer679
viewsrun python on another machine
Staff it is possible to run a python script on another network machine? Example: I use the dev01 machine and I need to execute a script for collection and data on the BD03 machine both machines have…
-
-1
votes1
answer151
viewshow to make the function follow a sequence?
def fnum_aleatorio(): a=22695477 b=1 m=2**32 semente=3 num= semente num_aleatorio = (num*a + b)%m if num_aleatorio <= m//2: return 0 else: return 1 i have this function, I want it to return me 0…
-
-1
votes1
answer126
viewsList float number formatting
I have a dataframe with Latitude and Longitude columns, in string format Atibaia['LATITUDE'].head() 140 -231,124,852,387,647 245 -231,159,749,902,692 254 -23,116,747,205 512 -231,560,912,572,211…
-
-1
votes1
answer250
viewsGet multiple Entry Python values
The idea is that the user type the number of lines and I create the entry according to this amount, this I managed to do, what I’m not getting is to get the value of these entry with get(). y1=0…
-
-1
votes1
answer961
viewsURI Online Judge - 2163 - Python 3
I’m having trouble solving the problem The Awakening of the Force of the URI. A long time ago, in a galaxy far, far away... After the decline of the Empire, scrappers are scattered throughout the…
-
-1
votes1
answer45
viewsvariable cannot admit another value
n=int(input("jogadas:")) a=22695477 b=1 m=2**32 semente=3 i=1 num=None num_aleatorio = None lance_computador = None while i <= n: lance_jogador=int(input("Faça sua jogada")) if i==1: num =…
-
-1
votes1
answer94
viewsQuantity in a dataset
I own this dataset I would like to count the instances of 'DATA_CRIA' in relation to this other dataset For that I performed this command, only it did not work: lista = [] for ano in anos:…
pythonasked 6 years, 3 months ago user9080886 21 -
-1
votes2
answers260
viewsPython string prefix
I made a script to download an attachment from an email, this attachment is an XML file, and I want to save it in a database. But when I get the XML body, it comes with the prefix 'b' and therefore…
-
-1
votes1
answer1698
viewsImage recognition/icone/figure on own python computer screen
I’m starting a study on image recognition, I got to work with Opencv I did some basic tests of face recognition and some objects that already come in the library, I would like to capture the screen…
-
-1
votes1
answer3786
viewsHow to press the button of a python website
I’m making a webscrapping of the club cipher site and picking up the most accessed songs of a genre. The code works normal but the way the page is made only appear the first 100 songs, to show the…
-
-1
votes1
answer696
viewsConvert time to number seconds without decimal part
I’m having trouble presenting the result of the transformation of a specific time, in the form HH:MM:SS, in seconds. The result is correct, but with a .0 in the end, which makes my response invalid…
pythonasked 6 years, 3 months ago Pedro Vinicius 1 -
-1
votes1
answer89
viewsPython Telnet server that changes the title of the Putty window
someone has some Telnet server script that changes the title of the Putty window from whom to connect to it?
-
-1
votes1
answer1754
viewsHow to install pipenv in Ubuntu 16.04 for python3
I tried to install using apt-get install pipenv, apt install pipenv but I was unsuccessful.
-
-1
votes1
answer115
viewsRank the contents of a Python list 3
For example I have a list [6,4,3,9,1] the answer to that would be the index of the highest value of this list in example order to the top list [1,3,2,0,4] these are the indices of where their…
-
-1
votes1
answer49
viewsSending mobile information to the web
Good morning my dear! I want to collect some data and send some information from Mobile (Android) to a website I am developing with (Python+Django). However I do not know the name of this cell phone…
-
-1
votes1
answer1859
viewsA solution to break/continue a Python loop?
The point is, I can’t find a solution that replaces using the console for my small application. What happens is: My app runs in eternal loop, but after it runs the loop, it should stop to ask if I…
-
-1
votes3
answers836
viewsLists count total amount and higher repeat
Hello, I would like to know how to count the number of items in an array, and also show the number that appears most. Example: given the vector [1,2,3,4,5,6,7,8,8] Are 10 elements 8(number with more…
-
-1
votes1
answer237
viewsConverting list to float array
I am working on an import of data, which are in format, as in the example: [-2.814285863362681, -2.814158589901394, -2.8123844084634873] [-2.874285863362681, -2.054158589901394, -2.6523844084634873]…
-
-1
votes1
answer395
viewsRoutes with flask
I am trying to separate the functions of its routes, creating only a file for the routes and a file for each function, but when I try to call this file from the function in routes it does not find…
-
-1
votes3
answers856
viewsValidate input without variable
num = int(input("Digite um numero: ")) if num <= 10: print("Ok, numero registrado") else: print("Numero invalido, digite outro numero menor que 10") If the number is greater than 10 is to type a…
-
-1
votes2
answers249
viewsDashboards of users logged in using Django admin user
Good Morning I am using Django’s standard user model, and I would like to have a Dashboard of logged in users, to check who is using the system, know me inform if Django has this information? I…
-
-1
votes1
answer228
viewsPlotting circles in different planes
I need to plot circles in the plans Zy and zx, but I only get in the plane xy, because when changing the variables x, y and z, forgive the shape of a heart. How can I fix this? import numpy as np…
-
-1
votes1
answer50
viewsHow to find repeated character blocks within a string?
I am doing a college job and in order to continue I need to take a message that has been given and find out if there are repeated blocks of characters inside that message and which is the block.…
-
-1
votes2
answers2194
viewsHow do I execute a command once every hour in python?
I want to run a code/line code once every hour while running the script in python, as I run every hour?
-
-1
votes3
answers1084
viewsPython Online Library of Justice
Read an integer value X. Then display the 6 consecutive odd values from X, one value per line, including X being the case. Input: the input will be a positive integer value. Output: the output will…
-
-1
votes1
answer2007
viewsProblem click python botan Selenium
I’m having trouble clicking a button, I tried it this way gives Elementnotvisibleexception: Message: element not interactable error pdf = driver.find_element_by_xpath('//*[@class="btn btn-default…
-
-1
votes1
answer181
viewsFill a list
I’m in need of help, I’m developing a genetic algorithm, well my problem is that I need my loop to not stop as long as there’s room on the list. As for example I have a population of 10 already…
pythonasked 6 years, 6 months ago Patrick Amaral 88 -
-1
votes1
answer119
viewsWho first executes the condition or code block in Python?
I’m having a problem and I believe it’s because of the execution order I can’t run such a block of code if it doesn’t go through a condition first if it won’t go wrong, and once I hear that in C it…
-
-1
votes1
answer611
viewsRenaming files with date in python
I would like to rename files from one folder and send them to another one, but I wanted it to contain the date or at least put a number after the name if I already had one. The code is this below,…
-
-1
votes3
answers1808
viewsWhen should I use "Return" or "print" in a function?
Can they exemplify some situation that can be exercised by one command but not another? Because here you gave the same thing in both commands. Using print: >>> def media(x1, x2): ...…
pythonasked 6 years, 1 month ago Pablo Leonardo 69 -
-1
votes1
answer126
viewsFunction with python repeat loop
Hello, I’m trying to use a function to get the full list of status-independent containers, "Docker ps-a". When I use code outside of function, it works. But when I use the same code inside the…
-
-1
votes1
answer301
viewsCapture images to create a database
import cv2 import numpy as np classificador = cv2.CascadeClassifier("haarcascade_frontalface_default.xml") classificadorOlho = cv2.CascadeClassifier("haarcascade_eye.xml") camera =…
-
-1
votes1
answer343
viewsDictionary for objects in Python
I wonder how I can assign a dictionary to a set of objects. For example, I have a 4x4 vector of 'neuron' objects': [[<__main__.Neuronio object at 0x1035644e0>, <__main__.Neuronio object at…
-
-1
votes1
answer2798
viewsHow to make multiple prints in the same line in python 3?
I want to know how to make prints to be shown in the same line using python 3. Example: print('1') print('2') 1 2 I wanted when python was going to print number 2, number one was erased and 2…
-
-1
votes1
answer3233
viewsTake only the value and format in 2 decimal places
Well, I have a python script that queries two different databases to verify values per day, one in SQLSERVER and the other in Postgres. I used an if to warn if the values were different and if it…
-
-1
votes1
answer1008
viewsWrite a function: int Solution(int A[], int N);
My teacher gave me this problem but I can’t do it int solution(int A[], int N); that, given a matrix A of N integers, returns the smallest positive integer (greater than 0) that does not occur on A.…
-
-1
votes1
answer54
viewsTake data from a page and go to the database
I want to do sweepstakes via Whatsapp. To participate, the person would send a message with the name to the number I will announce and she receives the confirmation reply and the token number. I…
-
-1
votes1
answer41
viewsSelect lines by first digits, and average them per year
I have a CSV of the following type: code year sales 2011 1970 5000 2011 1971 5200 2011 1972 ... ... 2015 1970 2015 1971 2015 1972 ... 3025 ... 3026 ... 3052 ... How can I select all lines from code…
-
-1
votes1
answer673
viewsHow to save binary files in python?
I am new to Sopt and would like to know how to save and open binary files in python. If possible I would like to see examples of how this is done and what the parameters mean.
pythonasked 6 years ago Alysson Marques 1 -
-1
votes2
answers1013
viewsHow to initialize this Tkinter Photoimage function?
Besides importing Tkinter, what do I call the function, for example: _show(?, 'the title'), what do I put in the first variable that is image? Show any example if it is on the desktop.…
-
-1
votes1
answer100
viewscalculate area and print it in another txt file in python
I have an area.txt file: quadrado;2 retangulo;2;3 I want to create another txt file so it looks like this: quadrado;2;4 retangulo;2;3;6 I did it this way but it’s wrong: arq=open('area.txt','r')…
pythonasked 6 years ago Matheus Andrade 205 -
-1
votes1
answer169
viewsPixel size of a Python String
I would like to know how to make a code in Python that checks the size of a string (in pixels). Guess: we have a string 'ALCON BOTTON FISH 50G' I would like to know what its pixel size to center in…
-
-1
votes1
answer43
viewsLooping no request
How could I make a looping to bring information from the request of a csv coordinate list and take the result to another csv? import requests import pandas as pd parametro =…
-
-1
votes3
answers115
viewsWhy doesn’t this equation compile?
import math def f(x): eq = (4-8*x)*math.cosh(2x) return eq a= 0 b= 1 erro = math.pow(10,-3) if f(a)*f(b) < 0: x=(a+b)/2 while (math.fabs(f(x)) > erro): x=(a+b)/2 if f(a)*f(x)<0: b=x g = (b…
pythonasked 5 years, 11 months ago Giovane Ramos 3 -
-1
votes1
answer474
viewsOpening a URL from Tkinter
It is possible link a website using Python code? For example, in a menu made in Tkinter (object orientation) I wanted to click button and be redirected to a site.
-
-1
votes1
answer121
viewsOnline software hosting using python and Django
I am developing a small ERP management software in Python and using the Django framework, so I had to install some requirements. How do I host this system? Is it like a website? What are the…
-
-1
votes3
answers8232
viewsA register of people in python
I was looking to make a record of people with id, nome and idade, created this code. The problem is in option 2, when show. I wanted to show like this:…
pythonasked 6 years, 4 months ago Nathan Silva 87