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
answer553
viewsSingle authentication Sign on Django and Grafana
Hello people I am using the iframes of the graphana in my HTML page running in Django/python, however every time I open my page to view the embed Graficos I need to access the graphana and so…
-
0
votes1
answer42
viewsHow do I remove characters from even positions in a string?
I have a string and I want to remove from it only the characters in even positions
python-3.xasked 4 years, 10 months ago Rafael Guilhem 11 -
0
votes0
answers41
viewsProblem with webscrapping (requests)
Precise scrape this site to search for doctors in a category. I send the requisition all right, pass the value (the type of doctor) and send via POST the requisition. However it does not return the…
-
0
votes1
answer245
viewsSave . doc file in database with Django
I’m developing an application with Djando and Python. In models.py, to create an object cliente with a name, for example, I do the following: class Cliente(models.Model): nome =…
-
0
votes0
answers28
viewsType matrix and display smaller/larger and their positions
I made the following code that generates the matrix with random values as the dimensions are passed, and brings the result of the lowest value and its position and the highest value and its…
python-3.xasked 5 years, 8 months ago MSSantana 326 -
0
votes1
answer732
viewsLoop to run python scripts
I have a loop process to run scripts in parallel, but the VPS that I will last does not allow to use parallelism, In that case I need to create a code like: scripts = [ 'siteodonto.py',…
-
0
votes2
answers175
viewsImport into different directories in Python3
Good night, I am hard at work trying to make a simple import of modules created by myself into my main code. With everything I always get the second mistake "attempted relative import with no known…
python-3.xasked 4 years, 10 months ago Whois 51 -
0
votes1
answer55
viewsHow to handle numbers larger than the FLOAT type in Python-3.x
I am having problems with the type of FLOAT data in Python. I have an algorithm that generates very large numbers, but the type FLOAT does not support them. See: 35 denominadorP = fatorial(p) 36…
python-3.xasked 4 years, 9 months ago Ismael Silva Limq 45 -
0
votes2
answers174
viewsProblem with input of more than one integer with input
I’m having trouble capturing the input of more than one integer into one input. Ex: numero = int(input('Digite o primeiro número aqui: ')) numero_1 = int(input('Digite o segundo número aqui: '))…
-
0
votes1
answer154
viewsError in tests with python 3.7, pytest and flask Blueprint
I’m starting a very basic Flask application for learning purposes. The apps are running normally. The problem is testing with pytest. I am using in pipenv: python 3.7.2, Flask==1.0.2,…
-
0
votes1
answer56
viewsWhy doesn’t he run my read() since I opened it for reading and writing at the same time
The code below allows me to write, but does not show me the content of what I wrote in the file with the read method() filename = input('Informe o nome do arquivo: ') filename += '.txt' arquivo =…
-
0
votes0
answers235
viewsTkinter: Treeview with repeated values after pressing "query" button
Every time I press the "Query" button treeview updates, but also by adding previous Rows. def consultar(): #função que Mostra na treeview todos os produtos cadastrados conn =…
-
0
votes1
answer116
viewsProblem Reading Unicode python file
Guys I got my script : import sys search = sys.argv[1] ref_arquivo = open('C:/Zabbix/RelatorioErros.txt','r').readlines()[11:] for line in ref_arquivo: if search in line:…
-
0
votes0
answers34
viewsupdate postgre going wrong
Follows the code: def update_table(file_name, id, column1, column2): conn = connect() c = conn.cursor() today = str(datetime.datetime.fromtimestamp(int(time.time())).strftime('%Y/%m/%d/')) query =…
-
0
votes2
answers120
viewsBeginner in Python
I can’t find a way to check several variables at once. Look what I tried: Example nota1 = 10 nota2 = 20 nota3 = 30 for i in (1, 2, 3) if nota{i} == 0 print('É zero') In this case, there are many…
-
0
votes1
answer138
viewsHow to read two numeric values for a list in the same line in Python?
I know that to read multiple values by input on the same line you use "split()", and to add values to lists, some loop like "for" or "while"but I would like to know how to join both to be able to…
-
0
votes1
answer294
viewsWhy does my print command not work?
my print command doesn’t work at all, when I use it in pycharm it doesn’t work and when I do a script with Idle it doesn’t work either, but when I do with the python prompt it works. script asks…
-
0
votes1
answer59
viewsHow to call a c# script inside a python script
Good morning, I did a lot of research and found that it was possible to fire a python process inside c#, my question is whether it is possible to do it the other way around, that is to fire a c#…
-
0
votes1
answer125
viewsError in Python code
I’m trying to run the following code but always appears this same type of error: "usage: bw2color_image.py [-h] --i I --p P --m M --c C bw2color_image.py: error: the following arguments are…
python-3.xasked 5 years, 8 months ago Rodrigo Ferraz 309 -
0
votes0
answers22
viewsWhat is the IS in Python for?
I’m doing a python course and I couldn’t understand the binary operator IS.
python-3.xasked 4 years, 9 months ago Davi Marques 1 -
0
votes1
answer103
viewsImprove Cognition of gTTS
you can improve the cognition of gTTS with Python? I am creating a project with emphasis on "voice recognition" for commands on the PC // Arduino // Rasp // others but I realized that when I speak…
python-3.xasked 5 years, 7 months ago Wallace Bruno 13 -
0
votes2
answers848
viewsProblem with balance of parentheses, in Python
Galera to with the following code: exp = str(input('Digite a expressão: ')) pilha = [] for simb in exp: if simb == '(': pilha.append('(') elif simb == ')': if len(pilha) > 0: pilha.pop() else: if…
-
0
votes1
answer103
viewsVariable declaration in Python
I have a question regarding the creation of variables in Python using Pycharm, always when I declare a variable a green underscore is displayed and the message that appears is: Type: In Word…
-
0
votes1
answer445
viewsCommunicate template with view
I have a Django project where I ask the user to enter two dates (initial and final), and through them I make a query in an external database, making an input works, but wanted to take this…
-
0
votes1
answer1186
viewsHow can I remove the first column of pandas numbers
Can anyone tell me how I can remove the first column of output of pandas and pepper column? Image of what I want to remove: My CSV: Link:…
-
0
votes1
answer201
viewsFill in field with "00-00-0000" when empty
I am making a recording in the database (Postgresql) with Python, I use a base on .txt. Problem: At the base have some records are blank, and is giving error at the time of recording, occurs in the…
-
0
votes1
answer530
viewsAnaconda for Pycharm on Linux
People I am not able to access, the anaconda in pycharm, first I tried to access two libraries and appeared this error. Libraries: import pandas as pd import numpy as np error: Traceback (most…
-
0
votes1
answer54
viewsFunction to increment the file name - python(opencv)
i have this code that saves me a video every time I run the program with the name video0. out = cv2.VideoWriter(video0.avi', fourcc, fps, (int(width), int(height))) I wanted him now every time I ran…
-
0
votes1
answer171
viewsHow to run a virtual python Environment on the linux crontab?
created a virtual Environment: python -m venv test pip install -r requirement.txt And I created a scrip C:\fnord\Documents\Scripts_python\test\Scripts\test.py So, how should I proceed to create…
-
0
votes1
answer413
viewsAutomatic update of the related model through FK - Django
I am trying to use Signal to do a subtraction update on a table based on the value the user selects. an example situation: On the table Materiais I have the pen material with the fields:…
-
0
votes1
answer87
viewsHandling characters not saved in variables with F'strings in Python 3
To manipulate unsaved characters in variables with F'strings I do this: print(f'{"String":^20}') I wonder if this is right, or would it be a scam for the fact that I have to define the string inside…
-
0
votes3
answers138
viewsThe why of using break
I wanted to know why the use of break in code(I realized that without break, the code is flawed): lista = list() pos = 0 for c in range(0, 5): n = int(input('Digite um valor: ')) if c == 0 or n >…
-
0
votes1
answer99
viewsReturn of a for in a python list
I would like to use the return of a for that list files from a directory to use in a Mysql command, but I can’t get all the files. thanks in advance for the help! #Lista os arquivos do diretorio…
-
0
votes0
answers114
viewsGraphical interface with Tkinter slowing my code
I’m making a little script to automate some things on Windows only one problem I found is to close it (after having converted to executable with the auto-py-to-exe) has to make millstone trampo,…
-
0
votes1
answer85
viewsShow specific attribute in Select using Python and Django
In models.py created the following tables: class UsuarioAdicionalPlano(models.Model): quantidade = models.PositiveIntegerField(primary_key=True) preco = models.DecimalField(decimal_places=2,…
-
0
votes2
answers470
viewsread the elements of an input matrix
I have a code that represents a checkerboard (8x8 matrix): print(f'ATENÇÃO: ') print(f'Insira 0 nas posições vazias do tabuleiro;') print(f'Insira 1 nas posições das peças pretas e 11 para as damas…
-
0
votes0
answers42
viewsInform two totals of different hours and have as output the amount of hours between the two informed
In this problem I cannot use any ready lib!!!!! So, in Python 3, I must do what is asked, however, I’m having difficulties to implement this, until then I tried to calculate the differences of the…
-
0
votes1
answer37
viewsVariable assigned to another parent variable
Hello, I’m having a problem with Python3: When I create a list and assign the value of another variable to that list, when I change the variable the list is changed, code: lista = ["uau", "nossa"]…
-
0
votes2
answers1060
viewsMake a program that inverts an integer number with two digits
You must print the inverted number followed by a final line. No need to print the 0 further left. For example, if the number typed is 30, just print 3 and not 03. num=int(input()) if num > 0: a =…
-
0
votes1
answer320
viewsChange distance on x-axis - Matplotlib
I’m mounting a chart using the Python matplotlib library but the result is not good! The names of the x angle are not visible. Follow picture Code: #-*- coding: utf-8 -*- #Meu Décimo oitavo Programa…
-
0
votes1
answer148
viewsHow to share a dictionary between scripts
I have a central dictionary that gets all jsons files from my working directory: def loaddata(): with os.scandir('Jsons/') as it: for entry in it: if entry.is_file() and…
-
0
votes1
answer67
viewsHow to create conditions in read and write text files (python3)?
So how could I pick up a text like this for example: "testo<br>de<br>exemplo<br>" and create a conditional (after giving the .open('file.txt', 'r')) for each time the program finds…
-
0
votes0
answers249
viewsPython matrix sum 2x2
m = [] for l in range(0, 2): m.append([]) for c in range (0, 2): valores = int(input("Digite valores: ")) m[l].append(valores) print("-"*30) print(m) print("-"*30) for l in range(0, 2): print("|",…
-
0
votes1
answer94
viewsInput of various inputs
I do not know how to solve this problem, the problem asks me between several inputs at once. example: 10 12 10 14 100 200 And after that give the difference between them line by line, I was trying…
-
0
votes2
answers1261
viewsPython URI Online Judge (1021): what’s wrong with my code?
Enunciation: Read a floating point value to two decimal places. This value represents a monetary value. Next, calculate the smallest number of possible banknotes and coins into which the value can…
-
0
votes3
answers1214
viewsbs4.Featurenotfound (Beaultifullsoup and parser error)
I need to extract all the text from an html. So I decided to look at Beaultisoup, to see how I did it with it. But he started to show the text right at the beginning, here’s the code: import…
-
0
votes1
answer342
viewsReturn word media in a dictionary from another function
I need a function that receives the result of a word counting function and based on these values, this function calculates the average of how many times a word appears in the text, stores that…
-
0
votes0
answers92
viewsLoop For with Zip(), how to select the amount of records?
I have this code that works normally def pdd(number, entrada): for i, j, k, l, m in zip(entrada[:-1], entrada[1:], entrada[2:], entrada[3:], entrada[4:]): if number in i: print([j, k, l, m])…
-
0
votes1
answer21
viewsHow to convert all_timezones to another format
I need to convert the timezones pytz to the following format below, but I’m having trouble doing this with python. How does this type of conversion work? from pytz import all_timezones time_zones =…
-
0
votes0
answers109
viewsProblem with Static files in Django project deploy on Digitalocean
I deployed a project Python and Django in the Digitalocean, but I’m having trouble with static files Inside my project, in the folder static when typing the command pwd to see the full file path, I…