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
-
2
votes1
answer1161
viewsTypeerror: start() Missing 1 required positional argument: 'self' when trying to use the Chronometer module
I installed the Chronometer 1.0 module for python 3.4: Chronometer module I tried to use the start() attribute of the Chronometer method, but gives an error: requires a self argument'…
-
2
votes3
answers31234
viewsHow to print skipping lines (each variable in a row)?
How to print skipping lines (each variable in a row)? nome ='Paulo' profissao = 'estudante' escola = 'estadual dourado' idade = 18 print 'Nome: '+nome + 'Trabalho: '+profissao + 'Escola: ' +escola+…
-
2
votes1
answer86
viewsScrapy queueQueue and mysql store
I’ve grouped 2 questions because I think they’re related. I made a script test, where saved in the database the links saved with your data. This is a bad practice? (High priority) Do I need to…
-
2
votes2
answers659
viewsProblem with float python (Uri 1098)
I’m trying to solve this problem and when I execute the code, at a certain point it stops working correctly. I think it’s because of rounding, but when that part is removed, the code runs to…
-
2
votes2
answers186
viewsDjango Rest and Angularjs Cors error
I am using Django Rest and Angularjs 1.x in a project, in case this backend project and frontend are isolated, I am using a server with Gulp to run the Angularjs, but when I try to access the Rest…
-
2
votes0
answers208
viewsHow to edit files and compile them in Python + Django
I edited a file. py, I compiled it but it says I don’t have permission. [Errorno 13] Permission denied: 'models.pyc'
-
2
votes1
answer228
viewsHow to allocate a Python (Django) project to a ready and configured server? (Apache, Mysql, Python, Django OK)
I have a server ready and fully configured. Python, Django, Apache, Mysql, all OK. I’d like to replicate an existing project on this server for testing. The files and database are already…
-
2
votes3
answers12149
viewsHow to check if a number is within a range in Python?
In Python, I would like to check if a number is within a range. There is a more pythonic way than the following code? if n >= 100 and n <= 200: ...
-
2
votes1
answer94
viewsDelete list item if directory does not exist
I have a list containing the path of some directories, I want to check if each directory exists, for this I use the os.path.exists(), if a directory does not exist, I use the method remove() to…
-
2
votes2
answers1231
viewsRegular expression (regex) for links to web pages using Python
I am trying to learn how to create a webcrawler. Part of the code will be to extract links on a web page (links starting with http or https): import re urls = re.findall(r'href=[\'"]?([^\'"…
-
2
votes1
answer140
viewsHow to identify an http (500) error via the Selenium web driver or javascript
I need to build a script that scans certain pages and locate http errors, specific to 500. I thought about making a Selenium script, but I don’t know a command that I can "read" this kind of error.…
-
2
votes3
answers225
viewsUpdate Python on LE 4.0 (Ubuntu 10)
Hello I need to use Simplehttpserver and only have for Python 2.6.6 and above and LE 4.0 is Python 2.6.5. As it has no software centre (at least I did not find) I tried this code on the terminal but…
-
2
votes1
answer160
viewsProblems with Python Frames
I’m doing a college paper, and I’m having a hard time messing with Frames, more precisely I need to construct the graph below. In the code, you walk through it from commands EAST, WEST, NORTH and…
-
2
votes1
answer132
viewsPython multidimensional array
I have a series of data that I would like to organize by title, example; movies = [ 'movie': [ 'legenda' [ 'dub', 'leg', 'nac' ], 'time': [ 1, 2, 3, 4, 5 ] ] .... ] I tried with dict() with list()…
-
2
votes1
answer6497
viewsCreating a chat program. How to make two talk simultaneously?
# -*- coding: utf-8 -*- #!/usr/bin/python3 import socket # nao tem servidor UDP no google -> vamos usar netcat como servidor UDP! #Programa de chat: so fala um de cada vez #implementar falando ao…
-
2
votes1
answer46
viewsComparing a data entry to a list, regardless of whether the word starts with a capital letter
I would like to know how to perform this comparison without taking into account if the month typed is capitalized or lowercase, since the program only works if you type in lowercase. prompt =…
-
2
votes3
answers1209
viewsExtract numbers from a list using Regex
I have the following list <type 'list'>: [u'1',u'2'',u'3',u'4',u'7'] The result I hope is: 1 2 3 4 7 I tried to use the re.findall(r'\d+', variavel) But it doesn’t work, note that I also need…
-
2
votes2
answers1365
viewsHow to add the result that is inside the Split function in python?
Input value: 6+5 Example: inside the variable data are the numbers ['6', '5'], print (data).split('+') how do I print the sum of these values?…
-
2
votes1
answer2024
viewsProblems executing commands in CMD with Python
I am unable to execute (or get the result) commands executed in Windows by Python. I picked up some code examples I saw on various websites and responses in the OS, but none worked well for me.…
-
2
votes1
answer393
viewsProblem calling DLL in Python ctype windows
I’m having trouble calling a dll in Python... this giving the following error: Windowserror: Exception: access Violation Reading 0x026A65F0, sometimes works without giving this error but most do not…
-
2
votes1
answer416
viewsReinstalling Python on Ubuntu 14.04
I’m new to linux and was trying to make an example using Scrapy. I did the installation of Python 3, but I already had Python 2 installed in my computer and I thought I would need to delete Python 2…
-
2
votes1
answer556
viewsChange lag and height of Excel cell using xlwt
I need to change the height and width of the Excel cell I’m using the library xlwt. I can’t find any references, someone can help me?
-
2
votes1
answer2994
viewsReturn the position of a word in a string
Could someone help me with this question? def fileRead(file): txt = open(file) print(txt.read()) def index(filepath, keywords): with open(filepath) as f: for lineno, line in enumerate(f, start=1):…
-
2
votes1
answer1067
viewsFind out python link
I’m making a Scrapping web in python and sometimes I come across some links and/or Buttons that are not with the real address of the url so you will be redirecting if you click. In this case, if I…
-
2
votes1
answer767
viewsPython code locking with time (Running in Rasbian)
I made a code in python, but it hangs after a while running, someone can help me optimize it to not crash? #!/usr/bin/env python #-*- coding:utf-8 -*- import serial import time…
-
2
votes1
answer466
viewsVisual Studio utf-8 error
I tried to use Visual Studio along with the tools to Python, but when I put: print("Hello World") and grip F5 it runs smoothly. But when I put: print("olá") he gives the following error: File…
python python-3.x visual-studio visual-studio-2013asked 8 years, 1 month ago Vinicius Barbosa de Medeiros 331 -
2
votes1
answer292
viewsObject assignment in Python
Can anyone tell me why in the first iteration the assignment retangulo=retangulo() works, but on Monday? This error appears in Pycharm: <<'rectangle' Object is not callable>> Code: from…
-
2
votes1
answer71
viewsHow do I get an argument in Web2py
I am with the following problem, I am producing an application in W2P, with a CRUD, on the part of deleting an item I am wanting to get the id through a form and that id remove the item the DB. I’m…
-
2
votes1
answer2263
viewsBank Account Validation Rules
Where do I get official bank account validation rules and check digit? After a lot of searching on Google, I can only find rules from ten years ago and on forums, with no source reference. I heard…
-
2
votes1
answer126
viewsWebdriver error in Python3.5 Attributeerror: can’t set attribute
I need to download the contents of a website. I made a code in python 3.5. When I turn it only to a single page the code works very well but when I put it in a loop or function it gives error. The…
-
2
votes1
answer212
viewsHow to include contents of a page . py on another page . py
How do I make a include or open a python page in another, for example in php: include 'content/filename.php'; Load Html it loads the file more .py no, I’ve tried the command open fp =…
-
2
votes1
answer181
viewsHelp with client/server socket with mathematical python sum interactions
I am studying about socket and wanted to make a socket that when the client type 5 and another 5 the server responds 10 and returns to the client the answer. How I change my code to have this…
-
2
votes1
answer743
viewsHow to return multiple values in a python function?
I am developing an API in Python FLASK and need to show the result of a SELECT that I made via SQL ALCHEMY. But when I use return he just comes back the first ROW of SELECT. The funny thing is that…
-
2
votes1
answer4248
viewsAnaconda is some kind of platform for Python?
Is Anaconda a type of Python platform/solution like Activestate or is it a distribution? I am using Windows operating system and would like to know if Anaconda is a good choice for Mining data!…
pythonasked 8 years ago user53564 -
2
votes1
answer865
viewsprint Qrcode directly Zebra printer by python
I am generating qrcodes by python, only that I want to print directly on zebra label printer, I can already print words contained in an entry, but when I try to print the error qrcode: code: def…
-
2
votes1
answer946
viewsHow to change the value of an object in python . json
how do I change the value of an object in python . json (without rewriting it all)? Ex: { "Nome": "Henrique Antônio de Oliveira" "Cidade": "São Paulo" "Estado": "São Paulo" "Idade": "23" "Número do…
-
2
votes2
answers176
viewsGenerate autoincrement serial number sequence
I want to generate a service order number, I have the code, but I want it to consult in the database the last number of the service order that was generated. Follows the code: def…
-
2
votes1
answer6338
viewsPython matrix manipulation with numpy module
How do I exchange lines of matrices, using numpy? I need this to implement the Gauss-Jordan method of linear systems solution with partial pivoting.
-
2
votes1
answer384
viewsIncrement a numeric string in 1
I want to add 1 to a counter that is represented as a string. the goal is to get the sequence of numbers later. For example: from 000570370 to 000570371. part of the code: def rangeOrdemServ(self):…
-
2
votes1
answer821
viewsPython matrix using matplotlib and mplot3d
Hello, The code below is with the following error: ValueError: shapes (1,2) and (3,3) not aligned: 2 (dim 1) != 3 (dim 0) Someone knows a solution? import numpy as np import matplotlib.pyplot as plt…
-
2
votes1
answer1338
viewsComparing lines from a file with data from a spreadsheet
I’m new to Python and I have a problem that’s getting me out of the picture... Here’s the thing, I want to get the strings of a file and compare its elements with the sentences written in the…
-
2
votes3
answers431
viewsHow to convert variable to String?
I have a function that takes a postgresql database code and visualize setting in QLabel with the function setText(). The problem is that this code comes from the database in strange format, between…
-
2
votes1
answer103
viewsCreate Views in the database from function
I am developing a simple application where you will need to create a views in Postgresql through Python function. Until then it seems a simple code, but what I did it does not create the views in…
pythonasked 8 years, 1 month ago Francisco Fabio 111 -
2
votes1
answer257
viewsHow to convert str to python
I have to make a comparison between 2 items, one is in Unicode, and the other is in str, being that what is like str is an array. for bloqueiosPermanentes in arquivo:…
-
2
votes1
answer725
viewsDynamic table in python
I have a problem and I can’t identify the mistake. I am creating a dynamic table in Python where it will be filled with database information. The problem is the code is repeating the first line of…
-
2
votes1
answer390
viewsCapture date from Qdateedit
I need to pick a date QDateEdit. I did the designer using Qt Designer, in properties activated calendarPopup and the displayFormat for dd/MM/yyyy. I want to capture this date to insert in a query. I…
-
2
votes0
answers101
viewsHow to write a List schema in python Eve
Hello. I am writing a schema and need to understand how to make a list using the Python Eve and Cerberus. Currently I write how the documentation teaches me: 'datasources': {'type': 'list',…
pythonasked 8 years, 1 month ago Gustavo Sabino 21 -
2
votes1
answer7101
viewsHow to read PDF
I am creating a script to grab a pdf and rewrite it in text. from StringIO import StringIO from slate import PDF from subprocess import Popen, PIPE, call import uuid #pego pdf existente url =…
-
2
votes0
answers860
viewsImport in Opencv installation
Today I tried to reinstall the opencv library on my computer, I did it by script pip, which downloaded the file .whl by the website: http://www.lfd.uci.edu/~gohlke/pythonlibs/. After the library was…
-
2
votes1
answer1940
viewsTypeerror: can’t Multiply Sequence by non-int of type 'str'
My problem is this: when I go to execute the code of an exercise it gives me an error that I’m not understanding why it happens. Typeerror: can’t Multiply Sequence by non-int of type 'str' produtos…