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
-
1
votes0
answers35
viewsProblems in transforming . py to . exe from my project to recognize images with opencv
I have a project of recognizing images using opencv, I separated it into 3 packages plus the code of the graphical interface in Tkinter that controls the activation. It works normally, but when I…
-
1
votes1
answer241
viewsRuntime error in python 3.8 - URI
I’m practicing some examples in the URI Online Judge and I’ve come up with this example: And I tried the following solution: numeros = input().split(); N1, N2, N3, N4 = float(numeros[0]),…
-
1
votes0
answers61
viewsI cannot import a file into the terminal using Pyhton
I have a very simple code in python version 3.9.0. When I enter the terminal and folder where the file is saved I try to execute the following command in the file name import terminal and an error…
python-3.xasked 3 years, 10 months ago Clarice de Arruda Heringer Mes 11 -
1
votes1
answer113
viewsClick a button that is not yet on the screen
I recently decided to do an automation using Python with the Selenium module. Everything was going well until I had to simulate a click on a button that is not on the screen at the moment and the…
-
1
votes1
answer190
viewsHow to count multiple characters from a string using Python
I want to count how many basic cracks of the type ATC (for example) have in sequence seq. What I’ve done so far is: # CONTAGEM DE NUCLEOTIDEOS # CONTAGEM DE TRINCAS/CÓDONS DE UMA SEQUENCIA seq seq =…
-
1
votes0
answers67
viewsDoubt regarding Excel manipulation through pandas library in Pycharm
I have a question regarding the manipulation of Excel through the pandas library. First I import the pandas library, then I assign to a variable the path that is the spreadsheet. import pandas as pd…
-
1
votes1
answer90
viewsPython How to click Divs using Selenium
I’m trying to take jobs in google jobs and extract data to guadar in database or json. Websites: GOOGLE JOBS SCREEN Notice how I have on the left a list with several jobs and when I click on some it…
-
1
votes0
answers55
viewsssl errors in urllib3
i created a keygen for hack the box (nothing illegal here, just automation), but in trying to run the code on macos I received the following error: Traceback (most recent call last): File…
-
1
votes0
answers57
viewsScraping on instagram
Hello, I would like to ask for a help, I’m wanting to do a scraping on Instagram to be able to analyze personas and extract some data as tags most used by people who follow a certain someone, I took…
-
1
votes2
answers177
viewsHow to find the umpteenth occurrence of a substring?
I need to do a function that takes as input a string, a letter, and a number that indicates the desired occurrence of the letter (1 for first occurrence, 2 for second, etc). The function needs to…
-
1
votes1
answer46
viewsInverting variables (Python)
I know you can do it in other ways, but I’ve done it limited to ifs. I wonder why I’m reversing the results in the last part of the code. from random import randint pedra, papel, tesoura = "1", "2",…
-
1
votes0
answers32
viewsscrapay+xpath returning empty array
I’m learning how to create a Crawler with scrapy + xpath. However, when I give the command scrapy shell https://br.udacity.com/courses/all/ The system returns this as if everything is normal:…
-
1
votes0
answers92
viewsApplying apply function on a pandas dataframe
I have a code (CODIGO01) that calculates the moving averages (21 periods) of a particular (individual) stock exchange share (IBOV - B3). Then I created a loop for where it determines q an asset this…
-
1
votes1
answer40
viewsgraphics generation automation with Seaborn is creating repeated colobars
I have the following problem: I have a database consisting of a 2D array of measures that vary over time. For each time measure, I need to generate a color map chart to be merged later into a gif or…
-
1
votes1
answer19
viewsProblems writing converted uuid from Binary(16) to csv file
From a query in MySQL I receive lines with the field in the format binary(16) of MySQL. I do the conversion using lib uuid and try to insert into a file csv. Does not write in format uuid in the…
-
1
votes2
answers97
viewsHow do I filter a Dataframe row by knowing a String value from one of its columns?
Let’s say I have at hand this dataframe And I know that a specific value inside a column called "Code", contains a String that I will call "mxrf11", in the whole dataframe will not have another name…
-
1
votes2
answers195
viewsHow to return a list where the size is set according to a number typed in the python input?
I would like the code I wrote to return a number of tuples according to the value entered in the input, for example, if the input is 3, the return will have to be 3 pairs of tuples. The following…
-
1
votes1
answer37
viewsJoin two columns with different dates
I have two dfs: 1 - Quotation of a share of the month of January-2020 (23 lines) 2 - Quotation of a share of the month of January-2021 (23 lines) I need to put all this together in a single date…
-
1
votes1
answer50
viewsHow to access the index correctly for data in the same file?
I have a file txt file.: >gb:KX262887|Organism:Zika virus|Strain Name:103451|Segment:null|Subtype:Asian|Host:Human GTTGTTGATCTGTGTGAATCAGACTGCGACAGTTCGAGTTTGAAGCGAAAGCTAGCAACAGTATCAACAG…
-
1
votes3
answers253
viewsHow to resolve "Valueerror: max() Arg is an Empty Sequence" error when the list is empty?
This error appeared when I was testing my program, more precisely when the values of input do not satisfy the conditions imposed: n = int(input()) listaVelocidade = [] for _ in range(n): velocidades…
-
1
votes1
answer96
viewsHow to sort a list of user-provided words using Python?
I’m trying to create a program where the user informs the list of words to put in alphabetical order, only when I put the program to run, it worked normally, but the list he gave me was listing…
-
1
votes1
answer57
viewsI need to inform the user if it contains a registered user with this same user name
Opa, then, I need to inform to those who are using the program, if you already have any user registered with this name and inform the age of the same contains in the list that must be registered…
-
1
votes0
answers41
viewsWhy can’t find_packages() find one of my code packages?
I’m trying to generate a distribution package for Pypi by setuptools. The problem is that the function find_packages cannot find one of my packet folders, called win32. The directory tree is as…
-
1
votes0
answers29
viewsHow to filter lines if column is without variable name - Python
I have some excel data that I imported into a Python dataframe (Base_Eventos). I need to summarize a variable (idPartida), then use: Base_Eventos.groupby (by = 'idPartida '). count() Only the result…
-
1
votes0
answers17
viewsDifficulty using tasks and create_server together (asyncio)
I am working on a tool that receives device connections, reads your messages and publishes these to a Rabbitmq queue. For the Rabbitmq queues I used aio_pika (simplest Pika) and created 2 different…
python-3.xasked 3 years, 7 months ago Guilherme Richter 11 -
1
votes2
answers51
viewsWhen one Function terminates the other ends also multiprocessing asynchronous functions
I’m using the library multiprocessing, running two def at the same time, but I want to finish one of the two def the other that is still running also end in the middle of the process. Example: from…
-
1
votes1
answer77
viewsValidate an integer number in Python 3
I am studying the Python 3 language and I am following an online course, where the teacher passes the following challenge: "Make a program that plays PAR or ODD with the computer. The game will be…
python-3.xasked 3 years, 6 months ago Dalton 11 -
1
votes1
answer47
viewsHow to make a formatted print?
Hi. I’m sorry about the basic question, but I started dealing with python a week ago. I’m writing a program that records candidates' votes in a binary file. But, at the time of displaying I am not…
-
1
votes1
answer45
viewsHow to exchange a word between a limit created by two specific points within a string?
Between the word fogo and the word gelo there is a content, and the goal is to change that content by sobrenatural code: s = "1 fogo bom dia gelo 2 fogo boa tarde gelo 3 fogo boa noite gelo 4" s =…
python-3.xasked 3 years, 6 months ago Felipe 25 -
1
votes2
answers231
viewsSelenium - Unable to login ( unsecured browser )
Hello, good evening, I am trying to develop a python web bot, using the library Selenium and webdrive_manager, but when I try to log in to my google account using the browser that the bot is…
python python-3.x selenium selenium-webdriver automationasked 3 years, 5 months ago Antonio Pacheco 27 -
1
votes1
answer89
viewsFilter Dataframe pandas with two or more conditions
I am creating a chart with dataset tips, for this I need to filter the data based on two or more conditions. My goal is to count the number of men, and the number of women. And also count only the…
-
1
votes1
answer76
viewsHow to print in the same line in python?
The function print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False) has the argument end and by default end='\n', I know I change for end=' ' will print in the same line. But I am…
-
1
votes1
answer63
viewsHow to align numbers on the left using str.format?
I’m studying about format strings and I’m not getting the same alignment behavior on the left with the minus sign (-) using the function format. What is the right way to do this using format?…
-
1
votes1
answer66
viewsUnboundlocalerror: local variable 'res' referenced before assignment - raster image scanning error (like numpy array)
I created a program that takes raster images (created in arcmap) and recognizes their polygons (their divisions). First, what I did was turn the image into a numpy array. Follow an example image…
python python-3.x array numpy image-processingasked 3 years, 4 months ago Sara Isabel Aleixo Perestrelo 13 -
1
votes0
answers24
viewsWhat is the logic in using Matplotlib and Seed?
To use Matplotlib, we have to import it and use the acronym plt to facilitate programming as follows: import matplotlib.pyplot as plt And every time we use this library, we need to reference the…
-
1
votes1
answer32
viewsFrame one image within another
I’m having a little trouble implementing the following situation: Read a folder with multiple images; I have to read the images and resize each one to 720x185 resolution; I was able to resize the…
-
1
votes0
answers19
viewsSlow iteration with pandas
I am using the following code to generate all chords of up to 6 elements, with 12 possible notes for each element. Then the amount of chords generated should be : (12*12*12*12*12*12) +…
-
1
votes2
answers48
viewsReturn rows from a dataframe that are not in another dataframe
Basically, I have a Dataframe (Database) that contains all the data registered in my system: data = {"Id": ["01", "02", "03", "04",'05'],"Fruta": ['Maçã','Abacaxi','Banana','Laranja','Morango']}…
-
0
votes1
answer482
viewsTypeerror: Ord() expected a Character, but string of length 2 found
if ord(c) >= ord('A') and ord(c) <= ord('z'): TypeError: ord() expected a character, but string of length 2 found I’m trying to create a Cipher matching algorithm, but I have a problem with…
python-3.xasked 10 years ago user14079 -
0
votes1
answer125
viewsCreate a function that returns information about a file
I have to create a simple function that writes information about a file to Idle. I had already done many functions of this type, I had already created a notebook in C#, but I wonder if what I am…
python-3.xasked 9 years, 11 months ago user14079 -
0
votes2
answers525
viewsConvert search with Pymongo: Dictionary in JSON
I’m using Pymongo to make a search: resultado = db.find_one({'nome':'xpto'}) The result of this search is a Python dictionary, but I need to convert it to a JSON. What’s the best way to do it?…
-
0
votes1
answer32
viewsIt is possible to modify the header comment of a file in Pydev
I’ve been experimenting with several Ides for Python, for example PyCharm or the same IDLE. Now I’m trying to use the PyDev as plug-in for Eclipse, and I like it. I wonder if it is possible to…
-
0
votes1
answer201
views"No module named pygame.base" - pygame and pypy
After several attempts and errors, I was able to install pygame 1.9.2a0 in pypy3, downloading the current version via Mercurial and installing via /path/pypy3 setup.py But when giving import, I get…
-
0
votes1
answer235
viewsScroll through the entire record
I wonder if there is a way I can go through the entire registry (keys and subkeys, do not need the value of them) of the operating system to find the name of a key in specific? If so, could someone…
-
0
votes2
answers1649
viewsAuto-start
I have a program in Python and I need it to start automatically along with Windows, I could not find any material related to it on the internet.
-
0
votes0
answers73
viewsHow to calculate the number of solutions to a puzzle using recursion
As an accurate work to develop an algorithm that calculates the amount of possible answers to a puzzle, the game consists of an arrangement of n black/white pieces, when a piece is removed the…
-
0
votes1
answer196
viewsHow to run a video inside a GUI
good evening, I’m having a problem. I need to run a youtube video inside a GUI interface (with Python). A community user helped me by providing the following code:…
-
0
votes1
answer290
viewsIs it possible to add non-native libraries to python?
I’m wondering if there is a possibility to add a non-native library from python. Example, I’m using the NetworkX to create graph, I need to install the library and everything else. I am wanting to…
-
0
votes0
answers76
viewsHow to read a . Kar file in python?
I’m trying to read a file. Kar and then print the letters on the screen, how would I do that in Python3? I tried to use Karapython, but it does not work in Python3, some help?
-
0
votes1
answer3982
viewsError: "in module named xxxx"
I have Python installed on my Pcs (Windows 7 and 8) but I can’t run any script that contains import. Error message always appears: import error: no module named xxxx.…