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
votes0
answers21
viewsMaximum Python Int Size Error 3
I made a simple algorithm in Python 3 that proves that the "If a number n is prime, then 2 n -1 is prime" theorem is false. However, I wanted him to do it with all the numbers up to number 50. But,…
-
-1
votes0
answers26
viewsDatetime does not recognize strftime
I’m trying to make a code that receives a date in the format of String, this way '2021-8-24', year month day, but I will convert to date, only the terminal speaks: data_converted =…
-
-1
votes0
answers27
viewsSyntaxerror: invalid syntax (python and pycharm)
I don’t know why you made a mistake in pycharm, how can I fix it? I used the following libraries import pandas as pd import yfinance as yf import datetime import lxml from kora.selenium import wd…
-
-1
votes0
answers20
viewsError "timed out Waiting for Launcher to connect" when trying to run in python in vscode
I have recently been having problems trying to run python code in vscode. It just started happening out of the blue. I’ve tried reinstalling vscode and python. But this problem insists on appearing.…
-
-1
votes0
answers25
viewsUsing Python to download a xlsx file from a website using set_preferences
I’m trying to download a file from a website using Python and I don’t want it to ask me if I want to open or save this file. Follow my code. I haven’t been able to figure out yet, where I’m going…
pythonasked 3 years, 2 months ago Fabricio Rezende 17 -
-1
votes0
answers16
viewsRegistration - Model - Django
Greetings! Next, I would just like suggestions or some direction, because I feel in the middle of the Atlantic with a piece of styrofoam. I would like to have in Django some types of users and do…
-
-1
votes0
answers9
viewsWindow closes alone with Pysimplegui and shows error
Hello, I am making a registration program that opens different other windows according to which button is clicked: By clicking open the "Register" or "Log-in" window, the window appears all right.…
pythonasked 3 years, 2 months ago Luiz Henrique 9 -
-1
votes0
answers18
viewsCreate a system with the Python programming language using the concepts learned in the lessons for the diagram,
A. Create a method to insert a book (all books must have a category. Ex. Mathematics); B. Create a method to list all books, when books are listed must show the category of the book; C. Create a…
pythonasked 3 years, 2 months ago Hebert Fonseca Guerra 1 -
-1
votes0
answers21
viewsI would like to make a calculator in python with interface that has sine, cosine, power and root
import Math import wx class Calcframe(wx. Frame): def __init__(self): no_resize = wx.DEFAULT_FRAME_STYLE & ~ (wx.RESIZE_BORDER | wx.MAXIMIZE_BOX) super().__init__( None, title="Calculadora…
pythonasked 3 years, 2 months ago Lucas Herler 1 -
-1
votes0
answers19
viewsReturn student name in query along with matricula - python and Django admin
Base Class: class Base(models.Model): IncPor = models.IntegerField('Incluido Por', null=True, blank=True) AltPor = models.IntegerField('Alterado Por', null=True, blank=True) IncEm =…
-
-1
votes0
answers34
viewsHow do you get regex to continue matching strings to a certain point?
I have a very large and confusing string that I’m picking up from a Crapping web. Here a piece: {"refineBy":"Filtro","feedbackYesLable":"H\\xc3\\xa1 alguma melhoria adicional que possamos fazer na…
-
-1
votes1
answer53
viewsHow to get back inside the while
I have a Dungeon code, in which the user can choose path 1 or path 2, each path leads to a room. In case he reaches room 8 I need a value between 1 and 5 to be drawn and return the respective room…
-
-1
votes0
answers9
viewsPython IIS running on default localhost
By putting my website to run on IIS, and accessing the domain I put pro even the site brings me the following error, stating that it’s running on the default localhost, even with the IDE Pycharm…
-
-1
votes0
answers22
viewslocal variable is not being changed? python jupyter
I have a var local that for some reason is not being zeroed print(pf,qcx) <------ essa linha é executada qcx = 0 <------ essa não i do not know debuggar in jupyter and do not understand why…
-
-1
votes0
answers12
viewsHow to generate csv through lines
I need to generate one. csv through a row I’ve managed to turn into a column, but I’m not able to break this column into other columns. Example: I had the following information in 4 tabs of my…
-
-2
votes1
answer171
viewsCan anyone tell me where the bug is please? Is giving "invalid syntax"
n = str(input("Informe o nome do aluno: ") m = int(input("Informe o numero da matricula do aluno: ") print("O nome do aluno é: %s, o numero da matricula é: %d" %(n,m)) …
-
-2
votes1
answer1573
viewsProgram that creates two vectors with 10 random elements between 1 and 100
Make a program that creates two vectors with 10 random elements between 1 and 100. Generate a third vector of 20 elements, whose values should be composed of the interspersed elements of the two…
-
-2
votes1
answer1037
viewsDownload a torrent with python
How to download torrent files with Python in a simple way? There is a library in python that does this?
-
-2
votes1
answer949
viewsHow to compress files using python limiting file size by 50 Mb
Good afternoon! I need help creating a python code that reads a folder containing images, check the number of existing images and compress the images in packages of up to 50mb.
pythonasked 7 years, 10 months ago Wanderson Leandro de Oliveira 1 -
-2
votes1
answer59
viewsI can’t run Def in Python
How do I execute a def and a return in Python? I always do it in edit mode and when I run everything is blank, nothing comes out,?
-
-2
votes1
answer523
viewsStructure of Repetition in Python
I need to solve the following equation in Python N is an integer and positive value. Calculate and show the value of E according to the following formula: E = 1 + 1/1! + 1/2! + 1/3! + ... + 1/N! My…
-
-2
votes1
answer822
viewsCount vowels and store in dictionary
Li this question and its answers but I still have one question. Wanted a function that counted the number of vowels in a text and stored in a dictionary where the key is the considered vowel.…
pythonasked 7 years, 2 months ago Carlos Ryan 1 -
-2
votes2
answers654
viewsSyntax error in if Else
frase1 = str(input("Digite uma frase: ").strip()) frase2 = str(input("Digite uma frase: ").strip()) print("O tamanho da frase1 é " ,len(frase1)) print("O tamanho da frase2 é " ,len(frase2)) if…
-
-2
votes1
answer452
viewsBar graph generated with Python has become unreadable. How to improve it? How to work with a dataset of more than 1 million lines?
Friends, The following bar chart was generated (the first column of datasets is UNIX time): The Python code (version 3.5) used was the following: # -*- coding: utf-8 -*- import matplotlib.pyplot as…
-
-2
votes1
answer16467
viewsError: 'int' Object is not subscriptable
In a long jump competition each athlete is entitled to five jumps. The result of the athlete will be determined by the average of the five remaining values. You must make a program that receives the…
-
-2
votes1
answer25847
viewsCommand to finish the program
Is there a command to finish the program in Python or can only finish using ways like this: print()
-
-2
votes1
answer157
viewsDoubt command in Python
I am migrating from batch programming to Python, in batch there was the "goto" command, which basically created a sub-area within the command: goto EXEMPLO pause :EXEMPLO pause So, when the command…
pythonasked 6 years, 11 months ago Darius da costa 303 -
-2
votes1
answer235
viewsError using Qlabel - Pyqt5 class method
I am trying to create an application that does the following: every time the user clicks on an image that will be inside a Qlabel, it will open a dialog for the user to open another image. It turns…
-
-2
votes2
answers182
viewsFinding strings in a log and other patterns
I’m trying to identify two strings in a log file: "Connected" and "Disconnected". But I’m not sure how to make it work. On my server I have stored several log files import os import time import re…
-
-2
votes1
answer74
viewsMethod to return string from an integer value
I have a function meses_dias that receives an argument, a whole number of days, and returns a string that says how many weeks and days that number represents. For example, meses_dias(10) must return…
-
-2
votes1
answer48
viewsWrite excel file within Scrapy project
I have a Spider that picks up the xlsx links, in Request I call the files and saved in: def save_file(self, response): f = open("teste.xls", "wb") f = write(response.body) f.close() But returns the…
-
-2
votes2
answers146
viewsTransform String into Algorithm
Can anyone tell me if there’s a way I can turn a string into an algorithm ? for example: a = "1 + 1" => b = 1 + 1. For simple examples it’s easy to create a string interpreter, the problem is…
-
-2
votes1
answer150
viewsPython program that automatically updates file folder
I’m trying to make a python algorithm that whenever I release a new version of files(ps. these files would be stored in the sd card, so they’re not a functional part of the algorithm), it could be…
pythonasked 6 years, 5 months ago Dale queiroz 1 -
-2
votes1
answer57
viewsWhy doesn’t print return all the items in a list?
The following code should return all cars from the following list: cars = ['audi','bmw','subaru','toyota'] for car in cars: if car == 'bmw': print(car.upper()) else: print(car.title()) But he only…
-
-2
votes1
answer36
viewshelp with request
I am writing a subdomain scan and did the following code (I’m sorry for making you cry with such): import requests while True: url = raw_input("url: ") lista = ['blog', 'ftp', 'cpanel', 'intranet']…
-
-2
votes1
answer62
viewsWhat are the differences between using a . txt and . bat file in python?
I am looking for practical and simple ways to save information in a separate file, that even after the closing of the program.py (in python) the information is not lost. And there was a question,…
-
-2
votes1
answer1844
viewsHow to change a specific word in a TXT by another
I need to change the configuration of the Zabbix server that is in this directory C:\zabbix\conf\zabbix_agentd.win.conf I need to replace the word: hostname= for hostname=192.168.1.1 I did that, but…
-
-2
votes1
answer757
viewsHow to change the display of the username on the Ubuntu terminal
How can I change my username display on the terminal ? With this very large text, ends up disturbing.…
-
-2
votes1
answer4270
viewsRandomly draw letters
I can generate numbers, but letters how do I generate type AB BC AEEE, for example. import random import string for j in range(40,100): print(random.choice(string.ascii_uppercase)) In this code I…
pythonasked 6 years, 4 months ago Joao Victor 7 -
-2
votes1
answer491
viewsHow to search the summary in Portuguese by wikipedia API?
How do I get the API to return the string in en? import wikipedia pesquisa=wikipedia.summary(keyword)[0:150] print(pesquisa)
-
-2
votes2
answers1565
viewsImport: No module named 'chatterbot'
Anyone help me? My code gives the following error: Traceback (most recent call last): File "main.py", line 1, in <module> from chatterbot import ChatBot ImportError: No module named…
-
-2
votes1
answer932
viewsHow to measure each individual element in a matrix
Hello, I have the following matrix: matriz = np.array([ [5, 5, 5], [5, 5, 5], [10, 10, 10] ]) and accurate the result with an array of their respective medias, thus: [6.66, 6.66, 6.66] Grateful…
-
-2
votes4
answers232
viewsTransform a numeric string into a list of python numbers
I need to turn an entry into a list. The entry has the following form: ['[11, 14]', '[8, 17, 18, 24, 29, 37, 44, 49, 51, 55, 62, 63, 64, 76, 82, 84, 93, 97]'] is read from a file csv. Note that it…
-
-2
votes2
answers66
viewsList counting elements
I have a list, like this: L = [0, 0, 1, 1, 1] If you used the command SET: L = [0,1] sum(L) = 2 The answer I need would be: 3. Each pair of answers would be one point, as it has two '0' = 1, one…
-
-2
votes1
answer103
viewsHow to add values from a for structure?
So, I need to solve a little problem in my code (I’m very newb), I’m just programming because I need it for my TCC, I don’t know much python but I’m trying to turn around. On line 126 there’s that…
-
-2
votes1
answer264
viewsMatrix - Python
I’m doing a college paper that requires me to do the Space Invaders game. I was able to make the game matrix and now I need to put the ships inside it, for now it’s like this: I need to print the…
-
-2
votes1
answer103
viewsProblems with the Python library
Can anyone tell me that the library "comtypes.client" is only from Windows? If yes, please tell me some similar library(That serves the same thing) pro Linux(Ubuntu) thanks.
-
-2
votes1
answer122
viewsLearning to Program - PYTHON IDE
I’m learning how to program the Python language and I’m using Vscode I downloaded vscod. When I hit "F5" to run code, it error. What I need to do, to open a "cmd" that I can type and test the codes?…
-
-2
votes1
answer14
viewsError in test code: Object() takes in Parameters
I made a test code, but I don’t know what the mistake, someone help me? class Caneta: def _init_(self, cor, modelo, ponta): self._cor = cor self._modelo = modelo self._ponta = ponta self._carga =…
pythonasked 6 years, 5 months ago DoutorWhite 111 -
-2
votes1
answer1065
viewsHow to resolve module error not found? (Installing opencv-python)
I installed opencv-python by Anaconda, but when I try to import it the error is presented: DLL load failed: Não foi possível encontrar o módulo especificado. Any idea?…