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
answer132
viewsRecursion in Python
I am trying to make a recursive function in Python that is not assigning me the correct results and when I try to change it it always happens stack overflow. This is my code: def sublistas(lista):…
-
0
votes1
answer105
viewspsycopg2.pool.Simpleconnectionpool, Operationalerror exception takes time to launch
I ran a test, shut down the server and called the method psycopg2.pool.SimpleConnectionPool, the method is waiting for a response for a very long time, about a minute, only then it raises the…
-
0
votes1
answer514
viewsHow to work with Updateview and Forms in the template
I’m trying to render a client’s data in the template, but I’d like to do it without using it {{ form.as_p }} or {{ form.as_table }} I would like to know if you have any way of using the id of the…
-
0
votes1
answer40
viewsProblems with Custom Template Tags in Django 1.8.5
Good night! First, I would like you to help me improve this topic, if necessary. Well, I work with Django 1.8.5, Python 3.4, virtualenv and other dependencies as well. My problem is. I have two…
-
0
votes0
answers102
viewsLogging module script: using os.getenv
I am learning Python and am following the book A byte of python. In an exercise talking about the logging module there is the following line of code: if platform.system().startswith('Windows'):…
python-3.xasked 8 years, 8 months ago Theo Oliveira 1 -
0
votes1
answer87
viewsPydev no Eclipse: Unable to get project for the run
I have a problem related to setting the Pydev interpreter in eclipse, every time I try to give Run, the following error appears: "Unable to get project for the run" Has anyone ever made that mistake…
-
0
votes1
answer93
viewsCSS error - Django Formfield
This is giving the following error in my Django 1.9 form See that on the label gets the :> in the end. I DON’T WANT TO SEE THE LARGER SIGN (>) AT THE END OF THE LABEL Ex: Nome: > Follow my…
-
0
votes2
answers247
viewsImage upload using CGI Python - Doesn’t work!
Hello, I created an html file with one and I intend to select an image from a directory and after clicking on Ubmit this image should be saved in another directory. Some help? That’s what I’ve tried…
-
0
votes1
answer533
viewsHow to print page
I want to create a template for printing data but I’m a little lost on how to do this, I have a print name button, the same is found in a table that contains the customer name, telephone address etc…
-
0
votes0
answers111
viewsPython 3 TFTP client
I’m Doing a project in python 3, is to create a client for Protocol TFTP. If i write "get 'file'" I just can download the first data block of 512 bytes of this file but I can’t send acknowledge for…
-
0
votes1
answer69
viewsHow to have boolean results from the interaction of two lists?
How to have boolean results from the interaction of two lists? That is to say: a = [1,2,3,4,5] b = [2,4] for each item in a belonging to b return true…
python-3.xasked 8 years, 4 months ago Mueladavc 161 -
0
votes1
answer594
viewsHow do I print the location (row and column) of the highest value within an array?
Good morning, I’m not able to complete my code, I’ve already used For i in range and for j in range, but I can’t complete the code because I need to store the result in another variable and then see…
-
0
votes1
answer76
viewsappend string and looping 'for'
def conf_dir_exist(lines): temp = '' print(lines) #isso é uma tuple. for line_a in lines: for line_b in line_a: if(os.path.exists(line_b) != False): pass else: temp += ''.join(line_b + '; ')…
-
0
votes1
answer338
viewsPython Opencv - Error using drawing function
I’ve been able to run this code before, but now it doesn’t work. It needs to draw a square on the video screen. Error: Traceback (Most recent call last): File…
-
0
votes1
answer177
viewsImplementing a TCP traceroute
I’m trying to understand the code below (found on the Internet): #!/usr/bin/python3 from scapy.all import * target = input("Informe um alvo: ") destport = input("Porta de destino: ") port =…
-
0
votes1
answer118
viewsCreating an ARPING
#!/usr/bin/python3 #Fazer arping de conexao import sys from datetime import datetime from scapy.all import * try: interface = input ("\n[*] Set interface: ") ips = input("[*] Set IP RANGE or…
-
0
votes1
answer243
viewsPyside facility
I’m trying to install Pyside in python 3.5 (32-bit), I installed Pip without problems, but I’m not able to install the easy_install, this error appears when I run on cmd here: But when I run the…
-
0
votes1
answer4056
viewspython progress bar 3
I’m trying to assemble a progress bar to tell the percentage of my Python script execution with varying different functions, however unsuccessfully how I would create such progress bar?
-
0
votes2
answers205
viewsRestrict __setattr__ when the attribute does not exist within the Python instance
Hello, I need to know how to assemble a class that cannot have attributes implemented after the instance. Ex: class Foo(object) def __init__(self, a='hello', b='world') self.a = a self.b = b…
-
0
votes1
answer389
viewsPython GUI: request interface and or ide tips for this
I’m redoing a small project I had done in Java, but now in Python. I’m learning everything from scratch and alone. I need help with this part. What interface do you recommend? Do you have an IDE…
-
0
votes1
answer256
viewsDictionary in python
Good morning! I’m having trouble breaking down the information and dictionary in python. My dictionary is a Biopython-generated dictionary like the one below: {'LastUpdate': '2016/11/11 04:34',…
-
0
votes1
answer367
viewsBreak lines with regex
I’m having a problem separating lines from several files txt. These files have a specific pattern but there are files that do not respect it. These are some of the 5000 files I’m trying to read:…
-
0
votes1
answer1296
viewsPython Tkinter: Window works perfectly but does not close after performing a function
code: def editar (self, event=None): ob = self.buffer(opcao=2) if (ob[1] == None): return elif (ob[0] == None): return root = Tk() root.withdraw() for o in self.lista: if (ob[0].codigo.upper() ==…
-
0
votes1
answer37
viewsType of a data structure
I am trying to count the amount of dictionaries exists in a list. However the condition always of false in the if. >>> type(record['TranslationStack'][0]) <class…
-
0
votes1
answer356
viewsCheck the type of input
Good people! I need to do an input check for a job and I’m not getting this right. This is what I got till agr: def verificação1(): while True: try: quantidade=int(input("Insira a quantidade: "))…
-
0
votes2
answers1034
viewsNameerror: name 'input' is not defined
I don’t understand the error in this code... def checkio(number): #Your code here #It's main function. Don't remove this function #It's using for auto-testing and must return a result for check.…
-
0
votes1
answer197
viewsReportlab - Python - Doubt with date writing (date)
Guys I’m having doubts in the reportlab. Python 3 Application / Django I have a model Pessoa that contains a field data de nascimento who’s kind DateTimeField. I’m trying to write the date of birth…
-
0
votes1
answer122
viewsDjango makemigrations command (1.9) does not recognize Blank = True in a Boolean field
I have the following model: class Site(models.Model): """ Model for a site entry @author: Leonardo Pessoa @since: 05/09/2016 """ from decimal import Decimal consolidated_financials =…
-
0
votes1
answer863
viewsLower() and strip() methods
print ("Escreva uma frase toda em maiúscula e sem espaços em branco") frase = input("Escreva uma frase: ") print (frase.lower()) print (frase.strip()) Upshot: Escreva uma frase toda em maiúscula e…
python-3.xasked 7 years, 10 months ago pitanga 550 -
0
votes2
answers949
viewsHow can I use Pip in a python version installed by pyenv?
I installed version 3.6.0rc2 on pyenv and really need pygame in this version. I tried to use sudo pip uninstall pygame and sudo pip install pygame and also tried to sudo pip3 uninstall pygame and…
-
0
votes3
answers1358
viewsHow to create a variable through the answer typed by the user in Python?
For example, we can use this code to assign the value to a variable: idade = input('Digite sua idade: ') What I’d like to know is, if instead of assigning a value a variable is possible to create a…
-
0
votes2
answers112
viewsHow to use "for" and "While" to capture cell tags from various tables in an html file?
I have several HTML files that I need to capture the data inside the tables, to launch in the database, but I’m not able to navigate in the html tree to find the tags that are cells, the html is…
-
0
votes1
answer52
viewsPython procedure for Problem class
I’m having trouble turning a function into a python class: from bs4 import BeautifulSoup from selenium import webdriver import html2text # driver.page_source = driver.get())# def getPEP(strg):…
-
0
votes0
answers209
viewsIs there a way to connect to a socket server hosted as localhost by CMD?
I wonder if there is any way to run my server in python socket and connect to it using command prompt. Is there any way to do it?
-
0
votes0
answers210
viewsHow to access Tupla elements?
How to access the elements of this tuple: StringElement('24929426', attributes={'IdType': 'pubmed'}) I want to extract the attributes: '24929426' 'IdType': 'pubmed' The excerpt of the code that…
-
0
votes1
answer5173
viewsTaberror: inconsistent use of tabs and Spaces in indentation
I’m trying to write a script and only the first part works: import re with open('lista.csv', 'r') as f: primeira_linha = f.readline() #print(primeira_linha) outras_linhas = f.readlines()…
python-3.xasked 7 years, 11 months ago pitanga 550 -
0
votes1
answer118
viewsTwo or more Scrollviews with background in the same Boxlabel with Kivy
I am creating a simple GUI with Kivy in Python 3x and have had problems putting two Scrollviews in the same Boxlabel. The way I put it, in the code attached, the items look like this: With…
-
0
votes2
answers49
viewsKnowing the type of return of a given
I have a problem with the return type of a data in python. I was first trying : >>> type(record[0][keys[2]]) <class 'Bio.Entrez.Parser.StringElement'> I tried to check by if…
-
0
votes1
answer678
viewsHow to convert a string to an integer in a socket program?
Here is an excerpt from the code: def CriarServer(self): Host = self.Txt1.get() Port = self.Txt2.get() sockobj = socket(AF_INET, SOCK_STREAM) #Erro sockobj.bind((Host, Port)) sockobj.listen(5) while…
-
0
votes0
answers27
viewsSqlite3 terminates INSERT without error
In my code I run a loop where I download some images of a URL and then save the name of the image in sqlite3, but after a few inserts the code simply ignores the line where the insert. if…
python-3.xasked 7 years, 9 months ago RFL 6,205 -
0
votes1
answer777
viewsInstall Mysql to use with Python
I’m first in python and I want to know how to install mysql to store terminal information. I use wamp/mysql to develop in php, is it possible to make some relationship between them? (use wamp mysql…
-
0
votes1
answer126
viewsInstall Curl Python library 3.4.4
Someone has a . zip link to install the "import pycurl" Use Windows and Python 3.4.4
-
0
votes1
answer94
viewsDjandorestframework standardize endpoints for methods with different permissions
I am using Django 1.10 with DRF lib. I created an Endpoint /api/contact/ and in this endpoint I apply 2 methods (GET and POST), and GET can only be viewed with permission, and POST can be requested…
-
0
votes1
answer322
viewsHow to filter PCAP file with Python?
The PCAP file was generated on 12/21/2016 and is 5 GB so it is impractical to try to open it with wireshark (graphical user interface) I installed tshark on Ubuntu and while reading the manual, I…
-
0
votes1
answer470
viewsCheck if subdomain exists with Python 3
I want to check if a subdomain present on a website exists. I tried to use urllib.request.urlopen() but it returns the status code as 200 even if it does not exist. This is because my provider…
-
0
votes1
answer49
viewsHow to escape HTML from an entry in Pyqt?
Both Pyqt4 and Pyqt5 can interpret HTML entities. I have a place where the text is displayed in HTML format. However at the time of sending a text made by a certain QLineEdit, I need this text to be…
-
0
votes1
answer86
viewsGame of life, what’s wrong?
I’m training Python and recently I’ve been trying to recreate the famous "Game Of Life", I managed to avoid code flaws but it is still not behaving properly. The program was to behave this way:…
-
0
votes0
answers282
viewsCreate super user inside a Docker container that this used with Compose
I have a Jango project that is running with Docker-Compose, what I need to do and very simple, run python Manage.py createsuperuser, however, even setting the command via dockerfile or in . Compose…
-
0
votes0
answers32
viewsIt is possible to import a lib . so x32 using an arm7l (Raspberry Pi 3b)
I was developing an application to run on a Raspberry pi 3 but while the mail didn’t deliver I started on the notebook (Linux Mint) and I didn’t have many problems. When I received the Raspberry I…
-
0
votes1
answer43
viewspq the input x iteration DOES NOT interfere with the while loop x iteration, where it is the same variable?
I am learning programming logic with Python and I don’t understand how the input x DOES NOT interfere with the iteration of the x from the while loop, which is the same variable. Please explain to…