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
votes1
answer304
viewsWeb Application for Script Monitoring
What is the best way to monitor the execution of a script? I have a.py script that needs to be running "endlessly", and I would like to know if it is running or not. I would like a web application…
-
0
votes1
answer325
viewsModule requests is imported into IDLE, but not into Thonny (the IDE I use)
I installed the module requests by Terminal with sudo pip3 install requests (I am using Mac) and managed to import it through the Interactive shell without problems in IDLE. But when I try to import…
-
0
votes1
answer26
viewsProblem displaying items in a qtablewidget
Only the first two rows of the table are filled, but the table row numbers are filled as the result of the query and in the print displays all items normally,. def escreveArquivo(self): con =…
-
0
votes1
answer39
viewsGraph with values of 2 in 2dB
How can I put these figures in the graph of 2 in 2dB, is coming out of one in one import matplotlib.pyplot as plt #============Ber teórico e Simulado sem repetição==============================…
pythonasked 7 years, 1 month ago Sergio Nunes 351 -
0
votes2
answers5228
viewsTypeerror: Calcularsalario() Missing 1 required positional argument: 'Title'
While trying to create a simple Python Code and I came across the following error in the method of calculating salary Typeerror: Calcularsalario() Missing 1 required positional argument: 'Title'…
-
0
votes1
answer88
viewsError using np.concatenate
I’m doing a mergesort using numpy library. It turns out it’s giving error in the line "np.concatenate(result,left[i:])" there in the merge function. That is the mistake: /sorts/main.py", line 30, in…
-
0
votes1
answer2368
viewsHow to go back days on datetime, python?
I need to return a string in the format "dd/mm/yyyy" in python, I got through the library datetime. import datetime date = datetime.datetime.now().strftime("%d/%m/%y") But I also need the date 7…
-
0
votes1
answer100
viewsDjango - Problems saving objects with UUID type ID in admin
Work on a project in Python with Framework Django and recently we decided to change the generation of Ids integer to UUID on grounds of merge data before synchronization (we have data that comes…
-
0
votes1
answer196
viewsProblem with Celery and Django/Python
I am trying to implement a tasks system with Celery in Django, but it is giving error and I do not know how to solve... Error that appears on console: tasks py. from __future__ import…
-
0
votes1
answer2338
viewsPython executable problem generated by pyinstaller
I made a simple software in python with graphical interface. I built it with pyinstaller and while trying to open the generated executable, the windows command prompt is also opened every time. I…
-
0
votes2
answers303
viewsHow to convert a string to this encoding?
I am trying to convert text into a binary language, but it keeps leaving letters in the result, I would like to create a text according to the numbering that each letter received: a = 10000 c =…
-
0
votes1
answer354
viewsInner Join ORM Django
I have 2 models: class MdlCourse(models.Model): id = models.BigAutoField(primary_key=True) category = models.ForeignKey(MdlCourseCategories, on_delete=models.CASCADE) sortorder =…
-
0
votes1
answer45
viewsI’m trying to test a game but every time I try to run it appears "invalid syntax"
import pygame def main(): #variaveix pygame.init() tela = pygame.display.set_mode([300, 300]) pygame.display.set_caption('THE GAME') relogio =…
pythonasked 7 years, 1 month ago KeddyHecky 31 -
0
votes2
answers1736
viewsHow to call a view method in html?
I created the following method in the views.py file: def home(request): name = 'Jacinto' args = {'myName' : name} return render(request, 'accounts/home.html', args) I now want to call this function…
-
0
votes1
answer849
viewsSwitch chained list pointers - python
I created a function to change the pointers of a chained list, the idea is very simple, change them and update the next element so that it does not lose the reference, only that the function is…
-
0
votes0
answers71
viewsTkinter==>Label/Msg present only 1 item in the list. How to resolve?
Well, the goal is to make, on the same label or msg, all the items on the list appear. I’m not very experienced at Tkinter, so I don’t know if there’s a limit to that. Follow part of the code below.…
-
0
votes1
answer1327
viewsNameerror: name 'setSaldo' is not defined
I am learning POO in python and am having a problem. When I try to use the getters and setters I am not getting. #Método Construtor def __init__(self): self.saldo = 0 self.status = False #Métodos…
-
0
votes2
answers104
viewsusing any in python
I have 2 lists with several fixed/mobile numbers. Example: Lista 1: ['0169924233316','01687665544','01978553322']<br> Lista 2:: ['0169924233316', '01788226541']<br> Within a go, I…
-
0
votes1
answer71
viewsPycryptodomex installation error in osmc Raspberry pi
When I try to install "pycryptodomex" or "pycryptodome" gives me this error here at the end, I already checked the header file "stdint. h" and it is in the folder described in the error:…
-
0
votes2
answers2091
viewsRemove Repeated Integers List in Python
I would like to remove repeated integers from a list and return a new list. lista = [1, 2, 3, 3, 3, 4, 5, 6, 6, 7, 8] The result would have to be this: [1, 2, 3, 4, 5, 6, 7, 8]…
-
0
votes1
answer6285
viewsPython prime numbers | while
I have the following problem: Write the maior_prime function that takes an integer number greater than or equal to 2 as parameter and returns the largest prime number less than or equal to the…
pythonasked 7 years, 1 month ago Pedro Henrique Santos 19 -
0
votes1
answer52
viewsSecond command does not work
I was testing the conditions, but when I use one command and then another, the second one isn’t working. c=str(input('')) if c == '/tutorial': print('ok, como vc é um hacker vc hackea td por…
-
0
votes1
answer779
viewsIndentation in Python
I wonder where I could put blank spaces to separate parts of the code according to PEP8. q = int(input('Quantos números sua sequência tem?(3 ou mais)')) if q < 3: while True: q =…
-
0
votes0
answers83
viewsProblem with the data acquisition time function provided by Arduino
I’m doing a Plot temperature vs Time via Arduino in a graphical interface. The program is crashing. Problem is in the function of time: # -*- coding: utf-8 -*- import matplotlib import…
-
0
votes1
answer691
viewsMeaning of %in strings!
Hi, I was following a video formatting lessons of strings in Python and I saw that the teacher used %d and %, but my internet is having problems to load the video, I wanted to know what that means %…
-
0
votes1
answer5595
viewsPair or odd through Random module (Python)
Recently I started learning programming language with python, I created a classic "game" to go learning with Random.randint for the user to try to guess which number was chosen by the machine. I…
-
0
votes2
answers659
viewsProblem using print to show function result
I’m creating a function that scrambles and returns the typed word, but I don’t know how to use the print (if this is really the case) to show the result of the function below: def f(): a = [] x = 0…
-
0
votes1
answer390
viewsHow to modify a list within a Python method?
Suppose I have the following method and the following list: def ModificaValores(Valores): dados = [6,5,4,3,2,1,0] Valores = dados Valores = [0,1,2,3,4,5,6] print(Valores) ModificaValores(Valores)…
-
0
votes2
answers198
viewsInstallation Cartopy
I’m trying to install the cartopy library. But I’m not getting it. Can someone help me? I tried by pypi and returned the following error: C:\Users\Rafa>pip install cartopy Collecting cartopy…
-
0
votes0
answers131
viewsDTMF sound in python
Does anyone know how to help me in this mistake here: Y1=np.sin(2*np.pi*F1*t) Typeerror: can’t Multiply Sequence by non-int of type 'float' The complete code follows: import matplotlib.pyplot as plt…
pythonasked 7 years, 1 month ago Gleiciane Silva 1 -
0
votes1
answer47
viewsWhat problem can occur when retouching a value without having a variable to receive (Python)?
If I have a function that returns a value or True and False, but doesn’t have a variable to receive, this may cause some problem in the functioning of the code? Example: def Retorna(): return False…
-
0
votes1
answer66
viewspyautogui error, values
I want to create a macro that performs some tasks. [OK] 1° Step: Remember the X and Y. COD: def recordMouse(): time.sleep(5) print "New record in 3s" x, y = pyautogui.position() c =…
-
0
votes1
answer1153
viewsHow to verify the existence of a file and the number of lines written in Python?
How best to check whether the file is existing and the number of lines inside the file.
-
0
votes1
answer223
viewspyhon error, pyautogui
I created a bot(macro) which has the function of making a few clicks in X time. I made the loop for this. def afkLoop(): #Loop pycontrol.broken() #Função time.sleep(1800) #Timer afkLoop() def…
-
0
votes1
answer592
viewsKivy event with keyboard
I’m creating a piano with kivy working all right, but only with the click of the mouse on the Button , I want to know how to type a key the Button run without I have to click with the mouse from…
-
0
votes1
answer487
viewsWhy make use of Python exceptions using raise?
For example: class ListaUnica(object): def __init__(self, tipo): self.tipo = tipo self.lista = [] def __len__(self): return len(self.lista) def __getitem__(self, p): return self.lista[p] def…
-
0
votes1
answer109
viewsFalse error opening decrypted document with Python Crypto library 2.7.9
I tested the following script in Python, using Python 2.7.9, with some adaptations made by me, available at…
-
0
votes1
answer164
viewsIntegrate Python language to websites. How?
Hello , :-) I am an apprentice in Python, and I have the following question: How can I start integrating the Python language into websites? If possible, what procedures should I follow?…
-
0
votes1
answer217
views"isdigit()" with 0.00 does not work
Why the method isdigit() does not identify that 0.00 is a digit? I am working with a few million data and certain records have values like 0.0000001 or 0.00. When I try to convert the 0.0000001 for…
pythonasked 6 years, 10 months ago Guilherme IA 1,414 -
0
votes0
answers72
viewsPython with CGI and WEB
I made a simple code in python that displays on a web page the version of the user’s operating system and configured my web server that runs on linux to be compatible with CGI. My webserver runs on…
-
0
votes1
answer188
viewsPREDICT error in Scikit-Earn
I recently started to learn a little about Machine Learning and grading, through a course at Alura. Well, I tried to perform the first exercise, but I couldn’t due to an error that I don’t know what…
-
0
votes1
answer265
viewsExecution in multiprocessors
I am researching about parallel execution in Python and I was left with a question that I have not found clear answer. Let’s say I want to multiply two matrices and add in a task list where each…
-
0
votes1
answer1322
viewsVector of objects in Python
I want to create a Node class, and one of its attributes is a Nodes vector (as in a chained list). Since Python does not declare the type of attribute, I have no idea dd how to do.
pythonasked 6 years, 9 months ago Leonardo Furtado 144 -
0
votes1
answer452
viewsGrammatically classify a word in English
It is known that it is possible to classify the words morphologically through the nltk module, but it works directly with English only, being necessary for other languages a complicated process. Is…
-
0
votes1
answer71
viewsHow to make a window stand above all?
I don’t know if it’s possible to do that, so I’m not even gonna put a code in here. My question is this, if it is possible to make a window stand in front of all the other windows, and I am not…
-
0
votes1
answer361
viewsHow to mount an array in python with undefined value of i and j
i am beginner in python and I am in doubt in matrix mounting. In case I did the following: import numpy as np n=3 A = np.zeros((n*n,n*n)) j= 2 i = 2 k = i+n*(j-1) a = -4 L1 = i-1+n*(j-1) a1 = 1 L2 =…
-
0
votes2
answers7124
viewsHow to get the directory from the location where a . py file is running?
I have a file. py of setup, so every time it runs I need to know the directory from where it is running, how can I do this?
-
0
votes1
answer147
viewsHow to disable text cursor?
I have a project in Gtk, which uses a Gtk.Entry text input and I need to disable the text cursor, or make it invisible. How can I do this? Or if I can’t, you can disable the linux system cursor?…
-
0
votes2
answers1225
viewsHow to check if the txt file has a blank space on the last line
i have a script here that searches all the files . txt from a folder and then joins them in one file only. The problem is that some files have a " n" in the last row, causing the next line not to be…
-
0
votes1
answer1055
viewsRead XML via Python
I need to take data in an XML file from another domain, initially I did a js, I had to abort. I thought of reading the files through . py within my Django project I tried something a little less…