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
votes1
answer2522
viewsProblem with Django form:Integrityerror: NOT NULL Constraint failed
Guys, I’m trying to make a form using model in Django that save the data when I click the button and redirect to a page, well I managed to make the form page, only after putting the necessary data…
-
1
votes1
answer164
viewsError in dictionary key
I am trying to store dictionaries in a list and then print according to the position in the list, however this giving an error in the key... Code below: nome = "nomedahora" cpf = "1421241"…
-
1
votes1
answer477
viewsWeb scraping at a specific url with Beautifulsoup
from bs4 import BeautifulSoup import requests import re url = 'http://www.bhaktiyogapura.com/2017/03/calendario-vaisnava-marco-de-2017/' header = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64;…
-
1
votes1
answer63
viewsHow to print a message saying that the searched element was not found in the list? Python 3
Hello, people! How do I print a message on the screen saying that the keyboard input is not in the list? Note: If the keyboard input is in the list (for example if the user type 'password'), the…
-
1
votes1
answer715
viewsCustom select on DJANGO
model py. class Produto(models.Model): nome=models.CharField('nome', max_length=100) marca=models.CharField('nome', max_length=100) categ=models.ForeignKey(Produto, verbose_name='Produto') class…
-
1
votes0
answers60
viewsAttributeerror('Handler %s not found') python3 gtk3
I recently made a code in python3.x and for the interface I used a file . However when I execute the code the interface opens but does not perform any action and interpreter returns me the error…
-
1
votes3
answers6545
viewsRun script written in Python in windows (No python installed)
I have a script written in Python(3.6) that works normally if run on my PC(which has Python installed) My question is: If I run it on some other windows that doesn’t have python installed, will it…
-
1
votes2
answers397
viewsCalculate how many Nan in each Python time
Good day, I have one DF where it has NaN And I need to count how many Nan I have at every hour. My df has a 31-day period. I believe I should use Groupby, but I’m not finding a way. import numpy as…
-
1
votes1
answer1118
viewsTypeerror: POST data should be bytes, an iterable of bytes, or a file Object. It cannot be of type str
I’m trying to translate a code from Python 2.7 to 3.6 Code 2.7 works perfectly: from urllib2 import Request, urlopen values = """ { "exchange_code": "PLNX", "exchange_market": "BTC/USDT" } """…
-
1
votes1
answer2106
viewsHow to make Python program run in 32 and 64 bits
I have a program made in Python(3.5) under 64 bit operating system, there is the possibility of I make it run in 64 and also in 32 bits in windows? NOTE: I used Pyinstaller to compile the program to…
-
1
votes1
answer56
viewsString equivalent using variables - Python 3.x
What would be the string equivalent : values = """ { "exchange_code": "PLNX", "exchange_market": "BTC/USDT" } """ Which the result is : '\n { n "exchange_code": "PLNX", n "exchange_market":…
-
1
votes1
answer78
viewsProblem in understanding this structure in a python string
I was studying file compression when I came across the following script: import sys import os.path import bz2 import zlib import base64…
-
1
votes1
answer186
viewsSlice proportional to dataframe size
How can I perform a Slice on the dataframe according to its line size? For example: if the dataframe has 14 lines, divide into 2 parts of 7, if it has 28 lines, divide into 3 parts of 7, and so on.…
-
1
votes1
answer198
viewsHow to set email as a Django username
I have the following code to create a custom User: from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin,UserManager class User(AbstractBaseUser,PermissionsMixin): username =…
-
1
votes0
answers58
viewsConverting Python Web Scraper 2.7 to 3.5
Good afternoon, everyone! Here’s the deal: I found a script in Python 2.7 but I have version 3.6. As I am new in this field, I wanted to work manually to convert this script. Follow the code below:…
-
1
votes1
answer136
viewsWhat problem, I can’t get the list to the other function?
def le_textos(): i = 1 textos = [] texto = input("Digite o texto " + str(i) +" (aperte enter para sair):") while texto: textos.append(texto) i += 1 texto = input("Digite o texto " + str(i) +"…
python-3.xasked 7 years, 7 months ago ulisses 11 -
1
votes3
answers2710
viewsget the 3 largest numbers from a python list
someone can help me find the mistake? """Returns a list of the three largest Elements input_list in order from largest to smallest. If input_list has Fewer than three Elements, Return input_list…
-
1
votes1
answer7020
viewsHow do I solve a potentiation problem in an alternative way?
I need help regarding the resolution of a potentiation problem in an alternative way. The goal is to show the result of the potentiation and the number of characters (or numbers) that appear in the…
-
1
votes1
answer896
viewsReference and Parameter in Python
I have a Python class that has a function that returns me a triple (3 information together) and I wanted to create 4 different objects because I need 4 different triples. The question is that the…
-
1
votes1
answer1359
viewsHow to pick up text, in CSS element receiving 2 class
I need to collect text from an angular system, where the element receives 2 CSS classes <div class="title ng-scope">80</div> I tested several ways to capture the text, but it does not…
python python-3.x selenium selenium-webdriver phantomjsasked 7 years, 6 months ago DaniloAlbergardi 347 -
1
votes0
answers24
viewsLayout manager for OLED displays
I’m working on a project involving technologies Python3.x, Raspberry pi and dysplays OLED. But there are several displays each with different resolutions and color range and I don’t want to…
-
1
votes0
answers885
viewsDistance table google maps api and python
Hello, I am using the Google Maps API to check the distance between two points, for this I have two local.csv files and coordinators.csv. The ultimate goal is to know the distance of the locations…
-
1
votes0
answers411
viewsError installing a library in Python 3.6 in windows
Good night. My question is very objective and direct. I’m trying to install a library in python 3.6 in windows 10 64 bits. However the following error is appearing : To install I am using Pip…
-
1
votes1
answer2433
viewsGraph using python-igraph with attributes per node and edges
Talk people! I’m trying to create a graph using the Python-Igraph library. Each node would have an attribute, for example, in a book graph whose nodes would be books and the attributes of those…
-
1
votes2
answers1536
viewsfunction to return the integer number
what I’m doing wrong in my job? num2 = float(input("digite um número não inteiro: ")) def arrend(numero): if num2 - math.floor(num2) < 0.5: numero = math.floor(num2) return numero return…
-
1
votes1
answer962
viewsWeb Scraping - convert HTML table to python Dict
I’m trying to turn an HTML table into dict@python, I came across some problems and I ask for your help. Go as far as I can go... def impl12(url='http://www.geonames.org/countries/', tmout=2): import…
-
1
votes2
answers1475
viewsFind the largest palindrome made from the product of two 3-digit numbers - Python
I’m having a problem. I’m creating a Python algorithm to find the largest palindrome made from the product of two 3-digit numbers. Code: i = 0 while i <= 999: temp = str(i * 999) tempInverso =…
-
1
votes1
answer9332
viewsLine break in a file . txt
How to break the line by passing my data to a file. txt? The code I’m using to open, write and close . txt are these: arquivo = open("arquivo.txt", "a", newline="") arquivo.write("%s;" %…
-
1
votes1
answer608
viewsChange encoding in pd.to_datetime
wondered if there is the possibility to change the encoding of an element returned by the function to_datetime pandas. I need to switch to ISO-8859-1 encoding to compare the date with others that…
-
1
votes1
answer35
viewsPython3 does not accept file.name
I’m with a script where I want to take the name of each file along the first line within each file and pass those in a list within a txt. #modifica titulos de arquivos import os import glob s=("-")…
python-3.xasked 7 years, 5 months ago h1k3r 925 -
1
votes1
answer311
viewsProblem using function . Join()
What’s wrong with this code of mine, I used the function. split() to separate the string when it finds ' ; ' after separating I wanted to join back by placing spaces so I used the . Join(), but saw…
-
1
votes1
answer725
viewsHow this recursive function (factorial function) behaves in Python
I don’t understand how the code behaves after it leaves the recursive function on line 7, fat = n * fatorial(n-1), i.e., how the code assigns the value to the variable n of this line and how is done…
-
1
votes0
answers34
viewsLogging request.META does not work with Django Channels + Asgi_redis
I have a custom class for logging and my Settings this way: base py. LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'verbose': { 'format':…
-
1
votes0
answers371
viewsPython session system
There is, in Python, a session system as exists in PHP? I need to do an access control for an application developed in Python that uses database. I have already developed a similar project (but web)…
-
1
votes1
answer83
viewsAssertionerror: b' Working with test classes in Django (TDD)
I’m starting my test studies with Django and I’m getting an error where apparently it shouldn’t, so much so that the description of traceback leaves me quite confused. I have a class that tests…
-
1
votes1
answer24100
viewsInput numbers in the same line in python
I need to read three values in a single variable being the third with comma. Input: two data lines. In each row there will be 3 values, respectively two integers and a value with 2 decimal places.…
-
1
votes1
answer500
viewsHow to redirect url with argument to another page in Django? (Updateview, Genericview)
Well, I have a very pertinent question. I am with an editing class of Django, and when I edit the user, I need it to call from the detail class of the same (Detailview), the two classes are working,…
-
1
votes1
answer608
viewsButton does not call function correctly
from tkinter import * class Application: def __init__(self, master=None): self.inicio = Frame(master) self.inicio.pack() self.msg = Label(self.inicio, text="Deseja exprimentar a versao input?")…
-
1
votes1
answer444
viewsUpdate values from a chart using Django
I’m playing in a solo project to make a website to show the current coffee quotation along with a line chart of the daily variation of this price as a function of time. I get the price value of…
-
1
votes4
answers1960
viewsBack position in data JSON format or list with Python
I am working with data similar to the structure below: {"Id":1, "Data_inscricao":"2017-01-01", "Texto":"Loremipsum", "Numeracao":26, "Tempo":"25s"}, {"Id":3, "Data_inscricao":"2010-05-02",…
-
1
votes1
answer236
viewsPython Error in if
I am having an error in the if and do not know how to correct this error, I am using Python 3.6 and Pandas for reading, writing and data analysis. df1 = pd.read_csv("JonnyTheBoy10.csv",…
-
1
votes2
answers7350
viewserror when conver string to float in python
Hello I’m having a problem I’m not getting Contact string to float the program takes the price of a dps game converts to string and position through the character and I am unable to convert price…
-
1
votes1
answer238
viewsput a command output in a python3 list
I’ve researched it, and I’ve tried to make it work in many ways. execute the order: ethers = [] ethers1 = os.system("ifconfig|grep eth|cut -c 1-4") ethers2 = os.system("ifconfig|grep wla|cut -c…
python-3.xasked 7 years, 4 months ago Anderson User777 63 -
1
votes0
answers47
viewsError rpy2.robjects in Ubuntu - Lookuperror: 'show' not found
I just can’t test python functions with R. In my notebook jupyter I did: !Pip install rpy2 And when having imported the robjects gives error: import rpy2.robjects as ro;
-
1
votes1
answer46
viewsOpen files that will be shared between various functions, inside or outside the functions?
Next, I’m making a program that I’m going to divide between the function module and the interface, and I need to use files in this project (and I can’t use classes), it turns out I need to use these…
-
1
votes0
answers242
viewsDjango Admin football game registration
Help me please. I’m learning Django. I have a website that registers games from my hometown. It follows example to understand doubt: Championship: Vacation 2017 Has 2 groups (Group 1 and Group 2) I…
-
1
votes1
answer487
viewsGet and Set using PROPERTY - Python3
As an apprenticeship of Property, created a small currency converter. See: class converteMoeda(): def __init__(self, dollar=0, real=0): self.dollar = dollar self.real = real def toDollar(self):…
-
1
votes1
answer1838
viewsDivision between column values and rows using pandas
I created a table pivot containing some values, but I do not know if it is necessary to use pivot table in this case below is a sample of the results: Valor ajuste \ Data posicao 2017-05-30…
-
1
votes1
answer860
viewsTypeerror: can’t Multiply Sequence by non-int of type 'float'
I’m learning to program in python, but I came across a mistake in trying to develop the merge sort using object orientation. When calling the method sort() who belongs to the class MergeSort, the…
-
1
votes1
answer968
viewsPython chart does not display all desired values
I would like only the values of the x, y coordinates corresponding to the points to appear in the graph. But it’s not like this: For example: The point whose x coordinate is 04/10/2017 09:41:00 does…