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
answer556
viewsHow to add text to a Qplaintextedit(PYQT5)
At first I would just like to know how to add values in a Textedit, however my goal is to take the values of the two comboBoxs and use them to generate the password. Follow the code: # -*- coding:…
-
0
votes2
answers142
viewsManipulation of items during iteration
In Python it is somewhat common to go through items of a everlasting handling or verifying the existence of a particular item, or whatever the operation is. I am reading the Python documentation…
-
0
votes2
answers745
viewstake a string string string string string string string [PYTHON]
I’m trying to get the specific value of a return I made using requests Python returned all the site’s HTML in print(Return.text), but I want to get only this input: <input class="give-input…
-
0
votes1
answer303
viewsProblem with larger and smaller (while)
Develop an algorithm that reads ten user-informed values and tells the highest and lowest read value. cont = 0 n = 0 maior = n menor = n while cont < 3: n = int(input('Insira os números:…
-
0
votes1
answer106
viewsDoubt about Python Apis
Good morning! I need to make a program that simulates the operation of a "user", these operations are taken based on various circumstances, would have to send code via Linux Terminal and cmd Windows…
python-3.xasked 5 years, 11 months ago Gustavo do Carmo H. 43 -
0
votes1
answer89
viewsDate validation composed of three integers in Django
In my application I am receiving from the user the day, month and year, the three fields are part of a form and are IntegerField. I don’t want to use the DateField, because the user has the options…
-
0
votes2
answers594
viewsHow to remove all text within a parenthesis?
I want to remove all the text within a parenthesis, along with the parentheses, to return only the text that is outside them, as follows: texto = 'bla bla bla (ble ble)' I want you to turn: texto =…
-
0
votes0
answers63
viewsError : Pending Templatenotfound
I want to create a basic application, but I’m not able to render Project structure ├── Project │ ├── Controllers │ ├── __init__.py │ ├── __init__.pyc │ ├── Models │ │ └── Conexao │ ├── templates │ │…
-
0
votes1
answer425
viewsHow to delete items in an array? (Python 3)
I need to build a program where the user will be able to delete events from the event schedule, but the problem here is that when he deletes another event,I mean, after he has deleted the first one…
-
0
votes1
answer66
viewsPython - Creating a program that changes itself
I would like to create a program that is able to change itself, that is, I run the script, and it changes the script itself, creating a kind of bookmark. The big problem is that I can’t change the…
-
0
votes0
answers39
viewsParsing data in a file containing systeminfo information
A "txt" file containing command return information was generated systeminfo, and I need to be able to copy some of the lines of the file, in this case, the ones that contain information about: total…
python-3.xasked 5 years, 11 months ago Homero 31 -
0
votes1
answer533
viewsGenerate file with Python dynamic name
I’m creating communication sockets for some server-based devices. I need these devices to record information in the same file at all times. The file name needs to be the first characters inside your…
python-3.xasked 5 years, 11 months ago Gustavo Bonze 1 -
0
votes1
answer1528
viewsPython 3 Tkinter: How to get a value/string from a Radiobutton inside a function?
I would like to take selected sex value and print in the Datatargets window, but it doesn’t work, not even the other data typed as name or age. I have here a main window where will display two…
-
0
votes0
answers278
viewsreading/manipulation of python images
I use Windows 8.1 ( 64 bits ); Python 3.7, Spyder 3 and Scikit-Image Library, all included in the Anaconda package. Here’s the super simple code: from skimage import io img =…
-
0
votes1
answer504
viewsHow to upload a Flask server in 0.0.0.0:80 on Ubuntu 16.04 Linux with python3 on an AWS EC2?
I need to run a Flask server in an EC2 instance. For this we need to solve these two steps: Open that door in EC2 Make Flask rotate in 0.0.0.0:80 The first step is ok. The door is open to interet:…
-
0
votes1
answer758
viewsPython- How to better store input (date) entries?
I have used write ("with open" "write") to overwrite and/or add date(personal names, address,phone) in the.py scripts, and it has worked out, but if I don’t take care it gets messy, both because the…
-
0
votes1
answer92
viewsHow to pass variable between class functions?
I need to pass the variable price for the function whatever of Tela4. I am new to both programming and the language itself and I have serious problems with this solution despite imagining that it is…
-
0
votes1
answer21
viewsI am learning about the Tkinter library, but my code is giving this error"'type' Object is not subscriptable"
def bt_click(botao): print(botao["text"]) janela = Tk() bt1 = Button(janela, width=20, text= "botão 1") bt1["command"]= partial(bt_click, bt1) bt1.place(x=100, y=100) bt2 = Button(janela, width=20,…
python-3.xasked 5 years, 5 months ago lucas 1 -
0
votes0
answers159
viewsQ: SQL login check ALCHEMY Pending
I am creating a login to give access to the tool I am starting to create, the database is SQL Server The structure of the project is this: ├── Project │ ├── Controllers │ │ ├── __init__.py │ │ └──…
-
0
votes1
answer8005
viewsHow to create a python function to connect sql server?
To summarize the connection process, I’m trying to create a function to connect the data bunch, but I’m not able to make the connection as expected: def conectar_com_banco(usuario): if usuario in…
-
0
votes1
answer42
viewsBubble Sort in python - Problem inserting values in list
Colleagues, I have a problem inserting values into a list, follow the thought: lista = [] for i in range(0, 4): lista[i] = int(input('Informe um numero: ')) for i in range(0, len(lista)-1): for j in…
python-3.xasked 5 years, 5 months ago Fabricio Paiva 340 -
0
votes3
answers42
viewsHow to simplify these two methods?
Well, in my class there are two magical methods, add and sub: def __add__(self, other): if other.__m == self.__m and other.__n == self.__n: result = [] for i in range(other.__m): lst = [] for j in…
-
0
votes3
answers5733
viewsHow to save the output result of a Python script to a txt file?
Script showing saved wifi passwords: import subprocess data = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8', errors="backslashreplace").split('\n') profiles =…
-
0
votes0
answers58
viewshow to count values assigned to vowels if these vowels are present in a WORD or TEXT?
First, my doubt is precisely on how to assemble the data structure (VOWELS and VALUES), ie, what is the best way to assemble the data "vowels" and their respective "values"? Or, what structure to…
python-3.xasked 5 years, 10 months ago Kabann 1 -
0
votes1
answer87
viewsI believe it’s an overflow mistake
I created two arrays as follows array1=np.arange(1000000) array2= np.arange(1000000) and when I did the following operation: array1*array2 I got that answer: array([ 0, 1, 4, ..., -731379964,…
-
0
votes1
answer40
viewsHow not to lose data from the app on Tkinter?
I developed a notepad app, but every time I close the app it erases all the annotated tasks, how do I make it not happen?
-
0
votes1
answer211
viewsTranspose columns to rows in Python data frame
Good evening Stack colleagues. First I want to thank you for the help that this vcs provide. I come please ask for more help. According to the image below, I would like to transpose all data…
-
0
votes1
answer35
viewsFlask application deploy error
I am trying to deploy a flask application in the same way I do when using python2.7, but in this case I am using python3 and an error is returned in wsgi. Below follows the first line of apache2…
-
0
votes1
answer187
viewsHow to create a file-based JSON map
Hello, I have a problem that is the following I have a map with the following format and I need to create a script that converts this map to a specific JSON model in python: Map template: TELEFONIA…
-
0
votes2
answers70
viewsOverride de Propriedade
According to some examples I found I’m trying to implement an override of a property, but the override does not work. I think this is a theme still a little obscure with few examples and little…
-
0
votes2
answers778
viewsPython pandas: Drop rows with duplicate column and another column with null value
I would like to drop in lines where the column 1 is duplicated and column 2 is null. I expect an output that way Col1 Col2 A 123 A NaN B NaN B 456 Exit Col1 Col2 A 123 B 456 I tried to do more or…
-
0
votes1
answer897
viewsCreate tuples with random values
Is it possible to create a tuple with random size and values? If so, how? ex: Run -->(0, 4 , 5) Run --> (2, 1, 7, 9) Run --> (7)... If it was a list I’d use the code: from random import…
-
0
votes1
answer50
viewsHow to find all prime numbers in a set of bounded values?
How to find all prime numbers in a set of { 1..100 }? PS: After finding certain numbers, I need store it in a result list (result = []). lista = [] result = [] cont = 0 for i in range(1, 1001):…
python-3.xasked 5 years, 4 months ago Bruno Carvalho 17 -
0
votes1
answer515
viewsRecursive function that returns the sum of the divisors of a number
As an exercise I had to create a recursive function that returns the sum of the divisors of a number. I made the following code, but is giving maximum recursion error: def somadiv(n, i = 1, s= 0):…
-
0
votes1
answer42
viewsBottle: accessing the same session on different Canister devices
Hello, I am developing a project to study character and I am with a great inconvenience. I’m using: astroid==2.0.4 Bottle==0.12.13 canister==1.5.1 Colorama==0.4.0 cymysql==0.9.12 Cython==0.29…
-
0
votes1
answer115
viewsProblem using if and Elif Python
I have a problem using the if and the elif to create an extract table taking information from the bank. If in the bank the transaction category is deposit, I want it print in a way, but after he…
-
0
votes1
answer25
viewsHow do I update the value of a variable within another script?
Basically to illustrate better, I’m supposed to have a.py file that has the following content: token = '' I created the update_file.py that has the goal of updating the token variable to another…
python-3.xasked 5 years, 4 months ago Felipe 31 -
0
votes1
answer274
viewsInstalling libraries from the linux terminal
Good afternoon, I’m trying to install a new library in python 3 by linux but I’m not getting it because every time I do pip install alguma_coisa he installs the library in python 2.7 and I intended…
python-3.xasked 5 years, 4 months ago user147847 -
0
votes1
answer60
viewsXOR operation by filtering my list values in Dataframe columns
I have several lists and a single dataframe, my goal is to filter my columns that contain the same values from my list and create a dynamic XOR operation. When you find my XOR result equal to 0, the…
-
0
votes1
answer54
viewsPython Subprocess checking whenever a new file is added
Need: I need to "observe" a directory, every new file inserted in this directory I need to make a copy of this file and forward to an FTP server. What I got: I can upload the file via FTP, and I can…
-
0
votes0
answers65
viewsPython - Send csv to database
I’m writing a script that joins all files of the same format into a folder and creates a single CSV and I want to send that CSV to the database. As new files enter this folder, CSV will always…
-
0
votes2
answers150
viewsMysql problems connecting to a python database
Good morning, When I try to connect python to a database I get the following error MySQLdb._exceptions.OperationalError: (1045, "Access denied for user 'k4os'@'localhost' (using password: YES)") I’m…
-
0
votes1
answer145
viewsCheck List elements within other Python lists
Good, I have two lists lista1 = [0,1,2,3] lista2 = [0,1,2,3,4,5] How do I confirm that all elements of list 1 are within Lista2 ? For example : lista1 = [0,1,2] lista2 = [1,2,3,4] lista3 = [0,1,2,3]…
-
0
votes0
answers39
viewsMove files in Python
I researched, and I saw people doing like this: import shutil shutil.move("este-arquivo", "/tmp") So I did it here in mine: import shutil shutil.move("arq.txt",…
-
0
votes0
answers950
viewsNo module named 'cx_Oracle' - Python
Everybody, good afternoon, everybody. I am trying to make a connection to the oracle database, but when I run my script gives this error to No module named 'cx_Oracle'. But I have it installed on…
-
0
votes0
answers68
viewsHow to fill a Textbox and scrape data with Python?
I’m trying to analyze some data of the secretary of education. I’ve already made the requisition, but... I found a way to do this through the web even, however, there are many schools for this…
-
0
votes1
answer122
viewsSlow loading of files into Static folder in Django
I am learning Django and I noticed that the static files take time to load, example; I have a css file that defines the style of the home, I change the font color and update the page and nothing…
-
0
votes1
answer451
viewsPoor performance when traversing an array
I’m traversing a matrix but face performance problems The idea would be to go through this matrix twice, in the second set of ties of the matriz_original if the condition is true the new matrix…
-
0
votes2
answers142
viewsI’m having repeat problems in python
while True: nome = str(input('nome do aluno: ')) if nome == 'sair': break elif nome in notas: print(f'\n{nome}',nome.upper()) n1 = float(input('Nota do…
-
0
votes0
answers34
viewsPython - Doubt related to structure, I believe
Can someone explain to me what it is and in what situation applies the way to create methods below: def show_preprar_dados(self) -> object: pass I don’t know what it means and what it’s for when…
python-3.xasked 5 years, 3 months ago Cleber Nandi 137