Most voted "python-3.x" questions
Python 3 is the latest version of the Python programming language and was formally released on December 3, 2008.
Learn more…3,274 questions
Sort by count of
-
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
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
answer70
viewsKnow the smallest number with Function min()
I want to know the smallest number of this list, which I present below the code. I don’t know where I’m going wrong, I think I need to convert the list. Example: lista=[1, 3, 5] def min(values):…
-
0
votes1
answer780
viewsHow do I make an object move on the screen using Tkinter?
I’ve already started my code only I don’t know what’s going wrong so that my object doesn’t move #Praticar movimentação de objetos from tkinter import* class Bola(object): def __init__(self):…
-
0
votes1
answer419
viewsPYMSSQL - error
People I am facing a problem with pymssql library, whenever I try to make a connection it presents the error below: This is the connection str: import pyodbc con = pyodbc.connect("DRIVER={SQL…
-
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
answer54
viewsFor i uses only the last variable - Python
Good morning! I am with a project that I am improving and would like to make a For i to run all variables within the project, but when running it applies the project only to the last variable. Code:…
-
0
votes1
answer310
viewsOutput print is not showing
I typed exactly that: import math num = float(input('Digite um numero: ')) print('A parte inteira do numero {} é {}.'.format(num, math.trunc(num))) However, when executing, only this appears: Digite…
-
0
votes1
answer441
viewsHow to clear the fields of a form in Django
I’m studying Django and I’m following a course, which is the creation of a Spending Control. However I am not being 100% faithful to the course, I am making some modifications. My problem is this,…
-
0
votes1
answer294
viewsBubble Sort in Python3
def bubble_sort(list): for i in range(len(list)): for j in range(len(list)-1): if list[j] > list[j+1]: list[j], list[j+1] = list[j+1], list[j] else: continue I just made this Bubble Sort, but I…
-
0
votes2
answers3007
viewsIdentify the day of the week of a given date
One of the questions of a college task is giving work to the whole class, so far no one has been able to answer question 4. A friend of mine tried with this code, but it doesn’t work right, because…
-
0
votes1
answer1396
viewsRenaming bulk files from a notepad list
I need to rename many (many!!!) photos inside some folders, so I decided to use the method the Name. within a loop from an auxiliary list in the notepad that contains in each line the old name of…
python-3.xasked 6 years, 6 months ago João Pedro Bueno 1 -
0
votes1
answer44
viewsImporting Module Within Module Python3
There are the following folders: └── Programa/ ├── main.py <----- Inicio esse... ├── bin/ | └── config.py <----- esse importa o db.py └── database/ ├── __init__.py └── db.py On the console…
-
0
votes1
answer39
viewsQuestions about type Python3
I was wondering if you could use the type thus: media = input("Digite o numero: ") média = input("Digite outro numero: ") if media == type('str'): print("oi") else: print("Tchau") That is, to check…
python-3.xasked 6 years, 3 months ago Shazam 1 -
0
votes2
answers709
viewsdouble for with python
Good evening. Staff made the connection to the database and I need to compare two tables tab1 and tab2 so that the external "for" fixes the first line of "tab1" in the zero column and "for" internal…
python-3.xasked 6 years, 6 months ago aguch 39 -
0
votes1
answer123
viewsLimit items in a dictionary
I am trying to analyze data from a research of own authorship, the files are already tabulated in .xlsx. format I use openpyxl. My intention at that time is to take the state of the participants +…
-
0
votes2
answers37
viewsTable does not want to be vertical
I wanted to know what I’m doing wrong, because I created a table in the template taking information from an api. Wanted to order themselves vertically and not in the orizontal. <!Doctepy html>…
-
0
votes1
answer530
viewsHow to print only the first column of a dataset with numpy?
How to print only the first column of a dataset with numpy? My code: import numpy as np data = np.genfromtxt("iris.data",delimiter = ",",usecols=(0,1,2,3)) print(data) My dataset (part of it):…
-
0
votes1
answer58
viewsPython3 Format print, to take bugs from symbols
import os with open('lista.txt', 'r') as lista: l = lista.read().splitlines() for s in l: v = os.system('ping '+s) print ((v).format) This ping works, but returns with symbols like: I saw that the…
python-3.xasked 6 years, 3 months ago Estagiário 17 -
0
votes1
answer118
viewsPython GIF API
is my doubt and the following I have this script where I type the name of the gif I want and it returns me several type of url of the size(width,height) of the randomly drawn gif, I wanted it to…
-
0
votes1
answer119
viewsError every time I make a Flask Requests
When I make requests from an Api to show the number of players in my template where "For in range (200)" returns the data and not the error. <table class="cor"> <tr class="fundo">…
-
0
votes1
answer115
viewspython - Print, by line, the letter and nickname append()
Based on the following list:: escritores = [['Pedro', 'Tamen'], ['Almeida', 'Garrett'], ['Camilo', 'Pessanha'], ['Almada', 'Negreiros'], ['Ibn', 'Bassam'], ['Antonio', 'Aleixo'], ['Ricardo',…
-
0
votes2
answers487
viewshow can I make a simple python Russian roulette
I wanted a simple scrip where it counts up to 6 using while or another repeating method. And there’s going to be a list with 5 failed and 1 died and he’s counting to 6 drawing this list and when he…
-
0
votes1
answer2279
viewsHow to install packages on Pip without internet access?
I’m having trouble with the python. I am providing service to a banking company, however the network is very closed, I can not download the files via pip. I can download the packages in another way…
-
0
votes1
answer33
viewsAdd the value 5 at the end of the list/tuple
lista_da_tupla_a=(["0", "33", "40"], ["8", "30","9"], ["7", "0", "0"]) lista_da_tupla_a = list lista_da_tupla_a[2] = "5" print(lista_da_tupla_a) Desired exit: (["0", "33","5"], ["8","30",5],…
-
0
votes1
answer68
viewsPython - Function with incorrect return
The code below is a simplistic example, but it represents exactly the error that is giving in my official code. def MontarURL(self): URL = "C:\\Users\\tttt\\Desktop\\Imagens\\2.png" return (URL) A =…
python-3.xasked 6 years, 3 months ago Bruno Almeida 59 -
0
votes1
answer180
viewsProblem when inserting rounds in stone game , paper and scissors
Good morning, I’m not able to implement a system of rounds in this game , the rounds must change when the player’s Mao is empty. , what happens now is that when the player and player list empty the…
-
0
votes0
answers42
viewsConnectivity between 2 pi Raspberry via Local Network
How can I connect two pi Raspberry over a local ethernet network, for example send a text from one to the other over the local ethernet network.
-
0
votes1
answer2703
viewsComparing variables in Python
Hello, people! I’m starting to learn python and decided to make a program about voting. As I do, for example, to compare the results of the votes and print that there was a tie between two…
python-3.xasked 6 years, 5 months ago Lady Pavlichenko 11 -
0
votes1
answer4801
viewsHow to encrypt password with Python
I need to encrypt password using Python, from what I saw in examples in PHP, they use a "module" that encrypts the password and which in theory does not decrypt, to validate the password they…
-
0
votes2
answers1911
views2 commands in the same python line
I wonder how I can fix this input('Acabei de encontrar a receita ') print('voce vai precisar dos seguindos ingredientes') num1 = int('6') print(num1) print('Kg de Farinha') num2 = int('3')…
-
0
votes1
answer309
viewsHow to view my index.html template in the Django restframework?
I have a problem with a test I have to deliver for a selection process I’m conducting. I’ve tried every possible and imaginable way to solve it, but I couldn’t. When trying to call an index.html…
-
0
votes1
answer23
viewsAdafruit_bmp in python 3
I am testing the BMP180 sensor on Raspberrypi 3 B+ and when I run the file on Raspbian gives me this error: when I run the same file from the command line it gives the values it should give, no…
-
0
votes1
answer89
viewsSmallest element of a sub-list, in a list
I’m trying to apply heuristics to a code that I’ve been working on, but I need to get the smallest element from a sub-list, from a list. example: L = [[1, 1, 6], [1, 2, 5], [1, 3, 7], [2, 1, 1], [2,…
-
0
votes1
answer1839
viewsPython - Error in using import, module --- has in attribute
Hello, I’m writing the code for a university project, but when I try to import dependencies to some files, from Error. I created some package’s that have files that have dependencies, but they don’t…
-
0
votes1
answer865
viewsRequests, Beautifulsoup <Tables>
I have a website that wants to extract specific data from a table I want to extract all information that has "PROLONG". My difficulty is that all tables have the same name in the "class"…
-
0
votes0
answers111
viewsInterface hangs while running while using from kivy.app
I’m studying image processing using Python. I interfaced with Kivy.app, but is catching when it runs the while. I am using the code below to fill an array with "0" or "1", making the image…
-
0
votes1
answer134
viewsWhy are you playing the Windows error sound instead of the specified file?
import winsound winsound.PlaySound('C:/Users/Computador/Music/Action!/som1.wav', winsound.SND_ASYNC) When I run this script the file is not touched som1.wav, but rather the Windows error sound. Why?…
-
0
votes1
answer53
viewsDescriptor with meta class vs traditional
I’ve been watching the videos (example) by Luciano Ramalho on Descriptors with metaclass. I wanted to know the advantage of this model in relation to the more traditional implementation of…
-
0
votes2
answers228
viewsHow to use this script for a server list? - Python
Good afternoon, you guys. I am using this code to update some servers here in my company, via ssh: http://alissonmachado.com.br/python-e-ssh/ on line 11, we have:…
-
0
votes1
answer1064
viewsTime between two dates
How do I know the amount of time in days, hours and months between two dates using Python? For example how many days, months and years there are between 22/11/213 and 25/03/2014.
-
0
votes4
answers208
viewsIdentify missing value in numerical sequence
There is a set of cards numbered from 1 to N. Among this set a card was lost, determine the number of the lost card based on the remaining cards. Given an N number, followed by N-1 integer values…
-
0
votes0
answers149
viewsHow do I make my music player choose an mp3 file and play it?
I’m having trouble making the program choose the music and play the selected music from tkinter import * from tkinter import messagebox from tkinter.filedialog import askopenfilename from pygame…
-
0
votes1
answer470
viewsIterating web pages using Requests and Python
I am beginner in web scraping. How to learn making a database from data on selling semi-new cars on some websites. One of the sites is this url =…
-
0
votes3
answers3591
viewsHow to use "while not in" in Python?
I tried to loop with while to check if a condition was met. If the user enters 0, 1 or 2 the program should stop asking the user which number he will choose. If the user chooses a number other than…
-
0
votes1
answer76
viewsHow to get back the amount of an existing word within a.txt file?
I’m trying to get as a return the amount of low-level words (bad words) in one text, using as a basis another file . txt containing the words (bad words). The code I made only returns 1 (one)…
-
0
votes1
answer76
viewsArchive keyboard entries in Python
I am building a code to retain any command made by the keyboard, they will be published in a topic of the ROS structure to control a mobile robot. I’m not very familiar with Python, the most I could…
-
0
votes2
answers443
viewsHow do I take data from an Entry and add it to the Database (sqlite3)
from tkinter import * jan = Tk() jan.title("Dados") jan.geometry("200x200+250+100") label = Label(jan, text="Nome:") label.grid(row=0, column=0) nome = Entry(jan, width=25) nome.grid(row=0,column=1)…
-
0
votes1
answer54
viewsCan I set Else to do two things?
I want to make a function in case the name entered is invalid, the program shows that the name is invalid and in addition, close the program or return to the starting point, this is possible in…
-
0
votes1
answer41
viewshow to take out data and add to an existing Python function
I’m creating a little game of dice but when I want to put a contain of points I’m not getting... def get_dados(): dado1 = int(input("Digite o número para o primeiro dado: ")) dado2 =…