Most voted "python" questions
Python is a dynamic and heavily typed programming language whose design philosophy emphasizes usability. Two similar but incompatible versions of Python are in use (2 and 3). Please mention the version you are using when asking a question about Python.
Learn more…8,642 questions
Sort by count of
-
1
votes2
answers259
viewsPython/Postgres
Hi, Is it possible to install a localhost server with Python/Postgresql? I know it is possible with PHP/Mysql, like XAMPP, WAMPP, etc.. I need to run a system that uses Python/Postgresql and my…
-
1
votes1
answer160
viewsWhat’s wrong with Twitter messaging?
import urllib.request import time def send_to_twitter(msg): password_manager = urllib.request.HTTPPasswordMgr() password_manager.add_password("Twitter…
-
1
votes1
answer529
viewsAccess Denied when entering value in windows registry by Python
In an attempt to create a function that inserted a value in a windows registry key, I came across an error. I use Windows 8 and Python 3.5. The function is as follows: def inserir1(nome,path):…
-
1
votes1
answer1006
viewsIoerror: [Errno 24] Too Many open files
When using the command python generator video.mp4 2 150 80 10 thumbnails.jpg I have the following return Extracting 734 frames [####################################] 100% Frames extracted. Traceback…
-
1
votes1
answer253
viewsPython Load Serialization Files
Hello, I’m studying Python for some time and doing some programs to join with Arduino. My question is on good practices in file uploading. I want to make a program that interprets files. My idea was…
-
1
votes1
answer119
viewsHow can we allow just one particular word?
How to make only the name "Maria" allowed by the program? I want any other word I put (e.g., John) the user can not proceed with the completion of the Form. nome = input("Coloque seu nome: ") cpf =…
pythonasked 7 years, 9 months ago Kenneth Anderson 313 -
1
votes1
answer1862
viewsWhat’s wrong with this python code?
import urllib.request import time def send_to_twitter(): import sys import tweepy CONSUMER_KEY = '1wrnsF5lB8fEWVzRdvlIqdTl' CONSUMER_SECRET = 'eTiylDUHLJgGnTCcxzzCtzHXG4OlHrbY6wLvuZUnAEhrokyNA'…
-
1
votes1
answer957
viewsHow exactly do you divide two variables?
In the code below I try to divide the values, but I end up getting a completely wrong answer from the calculation: nota1 = input ("Digite a nota 1: ") nota12 = input ("Digite a nota 1: ") nota2 =…
-
1
votes2
answers418
viewsBrowse 2D list in Python
I have the code below and I want to go through and display item by item from that list. However, I cannot do this because the entire list is displayed. I ask for your help. lista =…
-
1
votes1
answer363
viewsHow to save a hash to a file?
Code: h = {} arquivo = open("Tabela nome-idade.txt") r = True while r: nome = str(input("Nome: ")) if nome == '': r = False print(h) break idade = str(input("Idade: ")) h[nome] = idade My question…
-
1
votes1
answer968
viewsAttributeerror: 'list' Object has no attribute 'apend'
Why does this errp occur? "Attributeerror: 'list' Object has no attribute 'apend'" with this code? class Stack : def __init__(self) : self.items = [] def push(self, item) : self.items.apend(item)…
-
1
votes1
answer55
viewsOther ways to make matrix
I managed to develop so far, you should not print spaces after the last element of each line which makes the exercise go wrong, someone knows another method ? minha_matriz= [[1,2,3],[4,5,6],[7,8,9]]…
-
1
votes1
answer693
viewsHow to allow only a range of numbers?
I’m making a student grade number registration code, so I want the user to put a number between a range of 1 to 10, BUT I also want the breaks to be in float(ou seja: 0.1,0.2... 9.8,9.9,10.0).…
-
1
votes1
answer3097
viewsHow to create a Parser in Python?
For a project with file handling, I wanted to convert from "CFG" to "XML", and I believe that in Python I have no support for either of these two types. There was a colleague who made the…
-
1
votes0
answers70
viewsRun python file(by terminal) by Sublime Text 3
I currently use Atom to write my programs in Python. However, I want to migrate to sublime text for convenience and for being a lighter program. I use a plugin in Atom called: Atom-python-run. He…
python python-3.x sublime-text sublime-text-3asked 7 years, 10 months ago Vinicius Barbosa de Medeiros 331 -
1
votes0
answers246
viewsHow to debug python code in Geany IDE?
I am learning python programming and for this I am using the GEANY IDE in Fedora 24. I’m loving using it, but I can’t debug my code. I’ve already installed the debugging plugin. Would anyone know…
-
1
votes1
answer385
viewsPython: problem with list
Would anyone know how to explain and correct why the problem occurs in the exit below when I use repeated numbers? Thank you! The return must be presented in the reverse form and without the "0"…
-
1
votes2
answers3871
viewsMatrix multiplication
Could you help with Matrix in python?! The exercise is as follows, a function matriz_mult(n1, n2) takes two matrices as parameter and returns True if the matrices are multiplied in the given order…
-
1
votes2
answers6375
viewspython Manage.py syncdb does not work!
When trying to follow a tutorial I can’t go on because the bank wasn’t set up, you can help me? Error: Unknown command: 'syncdb' Type 'manage.py help' for usage.…
-
1
votes3
answers11849
viewsRestart application in Python
How to restart my program with Python? cpf = input('Digite os nove primeiros dígitos do CPF: ') if len(cpf) != 9: # Aqui deve reniciar a aplicação.
-
1
votes0
answers453
viewsParameters for a Python executable
I would like to know how to pass parameters to an executable file on python. i have a python script that will call an executable and I need to pass two parameters to this executable. I can call the…
-
1
votes1
answer1560
viewsHow to make a python script run two processes simultaneously?
A little while ago I learned to capture videos via webcam using Python with the Opencv library. After that, I had the idea of making a script that automatically starts and ends the recording of a…
-
1
votes1
answer226
viewsHas moon language Api for Python
I have heard that there are moon language Ipps to be used in conjunction with other languages like C, c++, c#, there is such an api for Python?
-
1
votes2
answers1215
viewsHow to pass arguments by value in Python?
def somentenumeros(entrada): try: int(entrada) return True except: return False while True: cpf = input('Digite seu CPF ou digite os nove primeiros digitos ') if somentenumeros(cpf) == False or…
-
1
votes1
answer262
viewsREGEX to Select a line that contains an unmounted string
I would like to select an entire row that contains a desired string. For example: String: "BLUE LED should light" text: When pressing the button the BLUE LED should light up for 5 seconds according…
pythonasked 7 years, 8 months ago Diego Sanches Garcia 13 -
1
votes1
answer287
viewsHow to Scrapping a page that has a javascript’s using python ?
I need to make Scrapping of a page, but the entry of the page has a button (apparently a Javascript) that gives access to all the content of the page itself. Using traditional libs(urllib2,…
javascript python web-crawler web-scraping scrapingasked 7 years, 8 months ago Wellington Araujo Nogueira 41 -
1
votes1
answer1139
viewsError: An operation has been attempted on an item that is not a socket!
I was trying to make a very simple door scanner, [Winerror 10061] No connection could be made because the destination machine actively refused them (q was the expected) for [Winerror 10038] An…
-
1
votes1
answer399
viewsError in relative python import
I’m looking to test simple python code using pytest. My hierarchy is as follows:: PythonExamples files mymath.py tests test_mymath.py in test_mymath.py, I import mymath as from ..files import mymath…
-
1
votes5
answers789
viewsList comprehension with conditional
My goal is to count how many elements of a given list correspond to a condition. To do so, I made the following lines of code: cont = 0 seq = [] max = 10 for x in seq if x == max: cont = cont+1…
-
1
votes0
answers99
viewsTest API Python
How can I test an api url using nosetest for example: I have the following api: /api/user how to ensure that calls at this url are being called? make a GET... one POST passing the parameters on the…
-
1
votes1
answer326
viewsPython/Mysql- How to get the id of a table by comparing with two different
I have the following two tables as shown in the following image: I wanted for example comparing the username (session level of each user) remove their id. I have used the following query but it…
-
1
votes0
answers159
viewsHow to resolve this syntax error in python?
I’m making a code to capture ping in MS of several sites for connection test and in one of the lines (follows below) is giving syntax error, I tried to fix and failed. if myStats.maxTime destIP<.…
-
1
votes1
answer812
viewsCheck if there is a file inside a specific directory
I have several files inside a directory called imagex, about 5,000 images. A simple example of a file: file_path = "C:/imagex/jonsnow.png" How to step check, efficiently, if there is a specific…
-
1
votes2
answers15955
viewsPrint multi-dimensional matrix in Python
I’m wondering how to create a function(imprime_matriz) which receives a matrix as a parameter and prints the matrix line by line. Obs: Spaces after the last element of each line should not be…
pythonasked 7 years, 9 months ago Monica da Silva Vasconcelos 87 -
1
votes4
answers6292
viewsRecover matrix dimensions in Python
Can someone help me write the function "dimensions(matrix)" that receives a matrix as a parameter and prints the dimensions of the received matrix, in iXj format? def crie_matriz(n_linhas,…
pythonasked 7 years, 9 months ago Monica da Silva Vasconcelos 87 -
1
votes1
answer2516
viewsCode that calculates days between two dates without using the datetime module
I’m making a code that calculates the days between two dates, but it cannot use the datetime module, and it only gives error. Here’s the code: usuariodata=input() usuariodata2=input()…
-
1
votes1
answer444
viewsReading CSV with Python
As I can go giving a "scan" in the CSV file and when finding certain String in the CSV line, print in another file the complete line with its values after the string. Ex When you find the string…
-
1
votes1
answer185
viewsPackages from Scapy
I’m having some doubts I can’t resolve about the scapy, Could you help me please? Doubts: To declare a package on Scapy I do: pck = IP()/TCP(). With this I can consult the layers of pkt, with for…
pythonasked 7 years, 8 months ago Filipe Andrade 11 -
1
votes2
answers2098
viewsHandling of Python Network Settings
Working in linux environment, Python 2.7, and I am in need of a module/library in Python that allows me to change the network settings (IP, Subnet, Gateway and, if possible, primary and secondary…
-
1
votes1
answer518
viewsCompare dates in an array?
In the date variable, you are receiving several dates in string as array, want to bring the smallest cont = 0 menor_data = datetime.strptime('31/12/2300', '%d/%m/%Y') while cont < len(datas):…
-
1
votes2
answers712
viewsRename application in Django Admin
Good evening guys, I’m trying to rename the application in Django admin according to the documentation, but it ended up not happening, I think I’m doing something wrong, the code is as follows:…
-
1
votes1
answer1063
viewsHow to create a sub-matrix from an array in Python?
I managed to generate a matrix via Python and through this generated matrix I had to generate a 3x3 matrix. But I don’t know how to do this, I was researching and I know that Python himself has a…
-
1
votes1
answer753
viewsHow to create a pause method and one that resumes a Thread?
The following script shows the x variable every 3 seconds, while the xx class, which is running on a thread, increases the x value every second. I would like when the value of x reaches 13, the…
-
1
votes1
answer1395
viewsHow to convert a date to timestamp in python?
I have a certain date in a variable in that format d/m/Y. Behold: strDate = "29/03/2017" How to convert that date to timestamp in Python?
-
1
votes1
answer62
viewsException in file . py
I have the following code: import socket from xml.etree import ElementTree as et import math, urllib import random, time, re global String_1, String_2, String_3, String_4, Chat, Using_Proxies,…
-
1
votes1
answer1292
viewspython library for working with video capture
Is there a Python library that is efficient( more than Opencv) to work with video capture and resizing its size ( change the image view size without changing the quality ) ? EDITED : In my case I…
-
1
votes1
answer1629
viewsPutting password in a python file
I’m making a program in which you select the file you want to lock using a password by clicking on a button that file is locked with a user-defined password. How can I make this file only be…
-
1
votes0
answers667
viewsProblem making python script request administrator permission
Use Python 3.5 on Windows 8 and a simple script presented problem: I want to copy a file from my desktop to C: Windows folder. First I tried that: from shutil import copy…
-
1
votes1
answer2796
viewsTransfer of python files, client-server
Guys I have a problem in my code, I need to develop an application that is able to send a file to a server and also be able to recover files from the server I’m using a tuple to send the data to the…
-
1
votes2
answers280
viewsI need help on a python Crawler
from scrapy.spiders import BaseSpider from scrapy.selector import HtmlXPathSelector from crawler.items import crawlerlistItem class MySpider(BaseSpider): name = "epoca" allowed_domains =…