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
-
-2
votes1
answer168
viewsType Object 'datetime.datetime' has no attribute 'datetime'
I have a view that matters some functions of a model, and when I import the model within the view, I have a problem with datetime. The function that exists in the model works perfectly, but in the…
-
-2
votes1
answer45
viewsHow to return the result of a function to a python file
Could you help me? wanted to return the result of this function in a file for after that generate it send it to another application. I have tried several ways, but even opens the file, but when I…
-
-2
votes1
answer80
viewsHow do I make my matrix scheduling algorithm work in python?
I need to make a program in python that reads a matrix A nxn and a vector B and then solve the system Ax=B, the function q I am using for the first part is global n n= int(input('Qual será a…
-
-2
votes1
answer43
viewsHow to relate a column A to B where column B starts with special characters?
I have the df as indicated in the image, and would like the user to search the element of column B and return the element of column A corresponding... What I was able to do was the reverse only,…
-
-2
votes1
answer39
viewsVirtualenv python between Win/Linux machines
I got a problem, somebody’s been through it ? I have a Python/Django project on a linux pc, and this project is in a repository on github. Dei git clone in this repositorio on another windows pc, so…
-
-2
votes1
answer74
viewsPython | Selenium | Looking for html element
Hello guys I am beginner in python and little knowledge in html, I’m trying to do makes a search for information on a dvr Intelbras via web page. until a certain point I manage to do what was…
-
-2
votes1
answer39
viewsHow do I change the import location of the modules in python?
import pygame The program gives this error, saying that there is no module It only works when I show the location for the show I’m starting my language studies. My python and vscode are installed on…
-
-2
votes3
answers94
viewsString validation using while in Python
The following code is intended to ask for the user’s gender ("f" or "m") and if the user typed another letter, he would continue to ask to type "f" or "m", however when executing it he keeps asking…
-
-2
votes1
answer55
viewsError closing a tab in Pysimplegui
I’m doing a test program with Pysimplegui, but basically it asks for a user, if it’s correct it opens a new tab with the phrase: "Success, you’ve logged into your account!" , and when it was wrong…
-
-2
votes1
answer51
viewsPyqt5 - Inheriting information from one class to another. (Python)
I created two windows in Pyqt5, where the first window needs to inherit information from the second, in this example I created: Tela_1: containing a "Qlineedit" for typing and a "Qpushbutton" to…
-
-2
votes1
answer46
viewsPyqt5 - Set an Inputmask on a Qlineedit to type only the "F10" key
I have an app that contains a Qlineedit that when active the user has the option to press the "F10" key and thus open another window. But I’d like to block that Qlineedit for editing, leaving only…
-
-2
votes1
answer62
viewsHow to read <br/> in HTML files and print as line breaks?
I made a web scraper using the modules BeautifulSoup and requests, that takes the definition and example of concepts in Urban Dictionary. This is code, using the word "reparation" as an example.…
-
-2
votes1
answer40
viewsfailed . append attribute when entering list entry - (Python)
I was able to leave my registration in loop that will be terminated only if the user type N or n. After closing the registration the program displays the registration lists and draw list, however,…
-
-2
votes1
answer64
viewsPython: how to validate how many files I have in a folder and send by email
Good afternoon, all right? I’m having a doubt in my python code, I’m trying to do an automation of sending emails with specific files, these emails I send daily and are random emails with random…
-
-2
votes1
answer22
viewsReverse for 'add' with keyword Arguments '{'product_id': 2}' not found. 1 Pattern(s) tried: ['Cart/add/<int:product_id>/']
Hello I’m studying Django and following a tutorial I got to the part of adding a product to my shopping bag, but when I click the add button in the bag it returns this error: Traceback takes me to…
-
-2
votes2
answers53
viewsHow to check if a variable received a new python value?
I have a Thread from a function that inserts data into the database and another Thread that every second receives a new value for a variable, however it may be the same previous value only "new". I…
-
-2
votes3
answers119
viewsPython: How to find the current date
I am trying to fetch some files from a folder that brings a pattern in the file name, in case it is 3067-EG3067000076 plus the date, but as they will be daily files the date changes daily and there…
pythonasked 3 years, 4 months ago Gabriel Terribile 1 -
-2
votes1
answer47
viewspython project on github with submodule
I have a python project and want to include a submodule (which is another github file) in the same directory, and I want it to be installed automatically during the installation of the main module.…
-
-2
votes2
answers36
viewsHow to use a function inside variable on out of function?
Past until today, I always made a mistake, I still don’t understand anything because it didn’t work. Someone can explain? I’ll use a code example: def test(x, y): if x == y: v1 = False else: v1 =…
-
-2
votes1
answer56
viewsDoubt about finding information in the database
I’m trying to make a simple system of login, would like the system to check the logins that are already registered in the database, so that you have no more than one equal registered. I am using the…
-
-2
votes1
answer54
viewsHow to create a button to change a text in my html with data coming from Django’s models.py?
I’m starting to work with Django and I’m starting a test to solidify what I’ve been learning. The idea is a single page, which displays a phrase as soon as the site opens. Below the phrase, there is…
-
-2
votes1
answer33
viewsHow to solve product scalar without using numpy library (python)
Hello, I’m trying to do this operation without using the Numpy library, which in itself is already a tragedy. I get from the user two vectors of equal sizes, and need to do the scalar product…
-
-2
votes0
answers26
viewsDoubt result of Python exploit
Hello, I’m new to programming, I’m running the following python exploit: https://www.exploit-db.com/exploits/45001 Code here from the exploit: import sys import time from pwn import * # parameters…
-
-2
votes1
answer79
viewsSendkeys error does not type Selenium - python
Hello, I am creating an automation with the webdriver and panda in python, where the values of the cells of a certain excel spreadsheet (xlsx) should be typed in the Chrome page. However, in a…
-
-2
votes1
answer53
viewsFind repeated values in a list and insert another value in its place with Python
I have a list that contains other lists with details of name, age and height of several people: pessoas = [['PAULO', 75, 1.74], ['ANDRE', 15, 1.87], ['PEDRO', 26, 1.46], ['JULIO', 75, 1.78],…
-
-2
votes2
answers70
viewsPython - Checking items in a list
I have a scenario, a little confused to explain... but I’ll try... I need to compare listA with listaB, where case 1 or more items from listaA are within the listaB, I print it on the screen, but in…
-
-2
votes1
answer46
viewsSEND E-MAIL TO MULTIPLE RECIPIENTS WITH SMTPLIB PYTHON
I am with a code that sends email to a single recipient. Now, I need that code: • SEND THE E-MAIL TO MULTIPLE RECIPIENTS AT THE SAME TIME OF UNIQUE FORM. EXAMPLE: I have 20 recipients, instead of…
-
-2
votes1
answer27
viewsHow to generate several Zips dynamically in memory, with Python?
I am reading a Python dataframe, and for each row of it, I need to save the column that contains an XML in a file, in memory, to later zip these files. So far so good. The point is that I need to…
-
-2
votes1
answer37
viewspython old game sometimes shows no result
made an old game program in python 3 but the problem is that when I choose an option does not show anything sometimes but certain part of the time works saying if I won or lost code: insira o código…
-
-2
votes1
answer40
viewsDoubt about substitutions in python replace method, how to better access the lists?
fix_start Given a string s, return a string where all occurrences of the first character of s were replaced by '*', except for the first. Example: 'Babble' returns 'ba**le' Assume the string is 1 or…
-
-2
votes1
answer59
viewsHow to Scrap with Python to compare prices on a shopping site?
Comparing the price of the same product every minute and notifying me when the value drops 50%. I used a While >= but it is returning an error indicating that you cannot use >= between str and…
-
-2
votes0
answers25
viewsPython installation hangs when installing "windows build tools" by NPM
I’m trying to run a project, but the same one gives several errors without python, ok, I installed: npm install --global windows-build-tools also tried: npm install --global --production…
-
-2
votes0
answers12
views"expected Ptr<cv::Umat> for argument 'points'" error
I downloaded a open source code for Detecting car Plates but I’m runing into a Lot of errors so if someone could help I’d appreciate . def check_plate(self, input_img, contour): min_rect =…
-
-2
votes1
answer36
viewsHow to make Speechrecognition listen to system sounds (youtube, zoom, etc.) instead of the microphone?
import pyaudio import wave import numpy as np import pyautogui import speech_recognition as sr CHUNK = 1024 FORMAT = pyaudio.paInt16 RATE = 44100 p = pyaudio.PyAudio() #stream usando o as_loopback…
pythonasked 3 years, 2 months ago Kenui Cabral 7 -
-2
votes0
answers47
viewsNameerror: name 'wd' is not defined (python)
Guys, can you help me please. How can I replace the wd.get for my code? Edit: Error presented Code running on colab: !pip install -q kora !pip install -U plotly !pip install yfinance --upgrade…
-
-2
votes1
answer76
viewsProgram problem that traverses two lists and generates a third without repeating elements
For a little over a week I’ve been trying to solve the following exercise: "Make a program that traverses two lists and generates a third without repeating elements." The statement in question is…
-
-2
votes0
answers19
viewsHow to make a scrapy post in python?
I am learning the lib Scrapy in Python and I am having difficulty to perform a request with the POST method for the url. I’m trying to use the following code: form={"letraLocalidade":"", "ufaux":"",…
-
-3
votes1
answer532
viewsStarting in Python Django
I am a web programmer working with Zendphp OS linux Ubuntu and decided to migrate to python. I have some questions. Python is an interpreted language! which server I will have to install so that…
-
-3
votes1
answer1483
viewsHow to create a TCP port scanner using the SYN (TCP SYN) method?
##################################### # Portscan TCP # # # ##################################### # -*- coding: utf-8 -*- #!/usr/bin/python3 import socket ip = input("Digite o IP ou endereco: ")…
-
-3
votes6
answers6752
viewsGet the list of prime numbers smaller than N
I have an exercise in which I need to enter a number (N) and calculate with Python which are the numbers below N that are primes. That’s the code I have now. num == int(input("Insira um número: "))…
pythonasked 7 years, 6 months ago Rodrigo Costa 13 -
-3
votes1
answer725
viewsHow to create a python code and connect it to Mysql
Eae Galera, I’m learning the database language, but I still don’t know everything to the letter so I came here to ask you for help to know how I can do this. I know there is sqlite3 in python but I…
-
-3
votes1
answer34
viewsEnterprise services in the cloud
The "breakthrough" of cloud services technology will lead to Webservices in the cloud rather than a private network of enterprise X or even local network?
-
-3
votes1
answer557
viewsError "expected an indented block" in my Phyton Calculator
I have searched for hours to Try to find a error in my codes and I didn’t get Anything! Please help me! [] []2 []3…
-
-3
votes1
answer1085
viewsUse of python Return
def repita(): x = 2 while n % x != 0: x += 1 repeat() while n > 1: n = n / x #aqui se encontra o primeiro problema, já que "n" não é reconhecido fora da função x += 1 if n % x != 0:#mesmo…
-
-3
votes2
answers1164
viewsSave data to a csv file
I’m trying to save data to a csv file from fields: def inserir(): camp1 = str(ed1.get()) camp2 = str(ed2.get()) camp3 = str(ed3.get()) with open("contatos.csv","w") as _file:…
pythonasked 6 years, 6 months ago washington luis 1 -
-3
votes2
answers1039
viewsGeometric Progression in python
Help me make a geometric progression in python that reads an initial value and a ratio and prints a sequence with 10 values.
-
-3
votes1
answer908
viewsHow to generate a python executable program
I started to see programming languages at a certain time, currently I’m learning Python, Javascript and other. And would you like to know how I can generate a program independent of the interpreter?…
-
-3
votes3
answers639
viewsHow to compress python code 3?
I wanted to leave this little piece of code in one line ... i = int(input()) for j in range(1,i+1): if(i%j==0): print(j) it is possible ?
-
-3
votes1
answer56
viewsShow on the screen the following operation with the tuple Tu: (ab)+(bc)+(cd)+(de)/e
Show on the screen the following operation with the tuple Tu: (ab)+(bc)+(cd)+(de)/e tu=(10,20,30,40,50) a,b,c,d,e=tu print(ab)+(bc)+(cd)+(de)/e NameError Traceback (most recent call last)…
pythonasked 6 years, 1 month ago WILLIAN JOAO AIRES DE TOLEDO 1 -
-3
votes1
answer75
viewsHow to invoke the function itself
def R(n): if n == 1: return 1 else: return 1/1/x-1/R(1/x+2/x)*n/1*n x=int(input("entre com x:")) print(R(2)) she does the following handle 1 divides 1/x -1 each iteration it divides 1/ 1/x -1/3/x…