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
-
0
votes2
answers880
viewsEnd loop when an entry is empty
I have the following situation: A repeat loop that asks for name, and 2 notes, where the data input should end when an empty name is read, but in the way below the second time the program runs the…
-
0
votes3
answers1047
viewsPython Indentation Problems in Geany
Since I switched from IDE ( moved from Pycharm to Geany ), I started having a lot of problems with the error: "inconsistent use of tabs and Spaces in indentation". I would like to know a way to…
-
0
votes4
answers1753
viewsComparing list indexes in python?
Good afternoon guys, I’m having problems with python lists... lateral = [] for i in range(3): lateral = float(input("Por favor, informe o valor de cada lado, seguidamente:" )) if(lateral[0] ==…
-
0
votes1
answer106
viewsCycle gives results Nan! How to get real values?
One of the parts of my script aims to determine the area of a graph by trapezoid approximation. Within the class I created the following function that manipulates the self.df, which is a Dataframe…
-
0
votes1
answer252
viewsTypeerror: a float is required
Good evening. I have the following Python code which, when calculating the variable h, the cited error appears: x=[] y=[] erro=[] h=[] x=0.1 y=0.1 for i in range (40): x=x**2-0.391*x y=y*(y-0.391)…
pythonasked 7 years, 1 month ago Priscila Guedes 35 -
0
votes3
answers12022
viewsRead 10 whole numbers and get the biggest one among them
Using a function, make a program that reads 10 whole numbers and print the largest of them on the screen. In the case of equal values, print any of the larger ones. If the largest number is multiple…
-
0
votes2
answers149
viewsWeb2py - Error using SQLFORM.Factory()
I can’t fix one error that appears when I try to expose a form to two tables of the SQLite. The error is as follows: Traceback (Most recent call last): File…
-
0
votes1
answer1835
viewsIndexerror: index 4 is out of Bounds for Axis 0 with size 4
Good evening. I have the following Python code, but the cited error appears: import numpy as np x=np.ones((4,1)) for k in range (5,45): x[k]=5.5369*x[k-1]*(x[k-2])**2+0.1931*x[k-3] print(x) The…
pythonasked 7 years, 1 month ago Priscila Guedes 35 -
0
votes0
answers64
viewsError correction code (repetition)
I have some questions in this code. I would like if someone could explain to me the functions. from scipy.stats import binom import matplotlib.pyplot as plt import numpy as np r=[2*i+1 for i in…
pythonasked 7 years, 1 month ago Sergio Nunes 351 -
0
votes0
answers47
viewsRead file . xls
I have a problem reading a file . xls using Python with Flask. My code: from openpyxl import load_workbook wb = load_workbook(filename=settings.MEDIA_ROOT + '/xls/arquivo.xls', read_only=True) ws =…
-
0
votes1
answer182
viewsChange color of a node in a Neo4j graph
I created an example graph in Neo4j with a father and two children. I would like to know how to change the color of all nodes that have the level 1. When I click on the node appears at the bottom to…
-
0
votes1
answer449
viewsText mining with Scikit-Learn
I’m doing some research in the area of feeling analysis, so I’m running some tests on a text database to get results. I was looking for tutorials among other forms of information on the internet and…
-
0
votes1
answer3283
viewsTypeerror: only length-1 arrays can be converted to Python scalars
Good afternoon. I made a small algorithm on Python, appeared the following error: Typeerror: only length-1 arrays can be converted to Python scalars. Someone could help me. Follow the code. import…
pythonasked 7 years, 1 month ago Cynthia Silva 15 -
0
votes4
answers7060
viewsI cannot import any Python module
I want to import the module requests from Python to a program I’m doing, but it doesn’t stop giving the following error, so I run the program: ModuleNotFoundError: No module named 'requests' I have…
-
0
votes1
answer717
viewsSelect widget in Django does not appear in the form
my signup page is not showing the selection fields, my code is as follows: Forms.py class InscricaoForm(forms.Form): VINCULO = [ (u'b', u'Bolsista'), (u'e', u'Estagiário'), (u't', u'Terceiro'),…
-
0
votes1
answer3550
viewscount how many times the word loaded from the txt file appears python
I need to make a program where I save a txt file, then open it and read it. So far so good. But I don’t know how to show how many times each word of the open text appears. Ex: The text appears the…
-
0
votes1
answer1588
viewsManipulating python text files
I know it is not possible to write to a file I open in read mode, but I was wondering if it is possible to read the lines of a file I open for writing, after having written on it?…
pythonasked 7 years, 1 month ago Morais Vilson 288 -
0
votes1
answer72
viewsWhat’s wrong here ? I can’t understand
from tkinter import * import random import time import math ''' Isso foi uma tentativa de criar uma inteligencia artificial. Não consegui encontrar os erros…
pythonasked 7 years, 3 months ago Patrick Freitas 1 -
0
votes1
answer8585
viewsIndexerror: index 3 is out of Bounds for Axis 0 with size 3
I have this code in Python, but the following error appears: Indexerror: index 3 is out of Bounds for Axis 0 with size 3 Code: import numpy as np import math A=11 T=(math.pi)/60 tf=15000 u=[] x=[]…
pythonasked 7 years, 1 month ago Cynthia Silva 15 -
0
votes1
answer245
viewsHow to adjust focus using Opencv and Python?
Hello. I’m building a robot that moves through acquired images. However, when it is in motion, it gets lost due to the image being out of focus. I ask if there is any configuration within Opencv…
-
0
votes1
answer931
viewsI want to save in a new txt file a copy of another txt in Python
arq = open("/Users/DIGITAL/Desktop/Python/novo.txt", "w") arq.write(palavras) arq.close() I’m using this code, but it only accepts string.
-
0
votes1
answer250
viewsHow to print a given list from a string of a . csv using python
The first part that is to detect the position of the list I have already managed, the problem is at the time of Else, would like to know a method by which the Else is not printed together with the…
-
0
votes1
answer76
viewsMy code Builds always incorporate Python 2.7 instead of 3.6, how to resolve?
When I will create executables of the programs I have suffered from it,and if anyone knows how to help, I thank.Follow the command line that I usually use to build at the prompt. python'filename'.…
-
0
votes1
answer858
viewsApis tips for checking bitcoin quotes
Hello, I’m new to this Bitcoin thing, and I looked for some Apis to check the currency quotes, however the ones I found I didn’t quite understand how these work, someone who understands more of the…
-
0
votes1
answer1335
viewsConvert word(DOC) document to pdf using python
I would like to convert a word(doc) document to pdf using the python 2.7. I have this script, but I didn’t understand anything about it. import sys import os import comtypes.client wdFormatPDF = 17…
-
0
votes1
answer563
viewsSend form Django
I’m new to python and I’m trying to register, when I click to send nothing happens, no post py views. from django.http import HttpResponse from django.shortcuts import render from…
-
0
votes0
answers208
viewsUser plot per week pandas
I have a csv file that basically follows below, I’m trying to separate user iteration number per week and plot a graph for each user. Hora Nome completo 8/08/2017 19:00 Joao 8/08/2017 19:00 Joao…
-
0
votes1
answer73
viewsHow to apply recursive action to csv.Dictreader
Hello, I created the following code but it only applies the function of creating the txt file using the last record of the CSV table, as I can do for it to create a file for each record of this…
-
0
votes1
answer1131
viewsHow to turn a python file into an executable?
If I create an application in python and want other people to be able to use it, will other people have to install python in order to run it or is there a way to make it executable? And to create an…
-
0
votes2
answers2587
viewsDelete a particular line from a . csv using Python
What I would like to do is that when the user typed the name of a person who was inside the file. csv, his line and the lines of movies he evaluated were erased (I used an identifier for this), the…
-
0
votes1
answer102
viewsSubtleties between Python and C
Good night! Sunday I discovered that I must learn Python, that the subject I will attend will be in that language and there is no way out. I studied well this week and managed to get to matrices,…
-
0
votes2
answers49
viewsHow to receive more than one user command at once?
For example: nasc= input('INFORME SUA DATA DE NASCIMENTO: ') RESPOSTA= 15112002 How to separate this into DAY/MONTH/YEAR ?
-
0
votes1
answer1701
viewsDelete certain lines from a python . csv
What would be the easiest way to delete only certain lines from file . csv within several other? No . csv below I would like just the lines of the Client (C) Cleiton and its films (F) that in the…
-
0
votes0
answers319
viewsHow to stop a progressibar in Tkinter
I have always developed in JS to half lost here in Python, if you can help me... I wanted to let the button close without an event until the progress bar is finished, and the progress bar at the end…
-
0
votes0
answers101
viewsApache, Python and mod_wsgi
Sirs, I use simple web applications, running in Apache2 and with PHP on the server, to automate trivial tasks on my work team. I use PHP only for LDAP and BD requests, using jQuery, lodash and pure…
-
0
votes3
answers3451
viewsHow to count the records of a csv in python?
I’m a beginner in Python and I’m having a hard time. I have a CSV database separated by ";" with 6 columns. I’d like to count how many records you have, the sex of which is "Female". You can tell me…
-
0
votes0
answers205
viewsHow to install python-yaml?
I installed the python-yaml module in an earlier version that I am using now, using apt-get install python-yaml, but now when I went to try to use the module in the new version it says it does not…
-
0
votes0
answers270
viewspygame.time.Clock.tick() why not use 60?
Why do most people use 40 instead of 60? 60 fps is no longer considered ideal? Is there a recommendation to use 40? And if I just call the method tick parameter-less?
-
0
votes1
answer93
viewsI am unable to use get_rect with Convert/convert_alpha and subsurface
I was doing so: class Esqueleto (pygame.sprite.Sprite): def __init__ (self): self.imagem = pygame.image.load("imagem/esqueleto.png") self.rect = self.imagem.get_rect() self.imagem =…
-
0
votes1
answer37
viewsWhat class should the text class inherit?
When using pygame it is very common for user classes to inherit from pygame classes, for example a class of characters usually vaqi extend the class pygame.sprite.Sprite. But a text class could…
-
0
votes2
answers787
viewsHow to add up several numbers that were typed in the output?
What I got so far: for c in range(3): n = int(input()) n += n #tenho quase certeza que essa parte não está certa print(n) How to add up several numbers that were typed in output?…
pythonasked 7 years, 1 month ago Lucas Souza 567 -
0
votes1
answer1550
viewsCommunication between two programs in PYTHON
Guys, I’m developing two programs that have to communicate with each other, I tried the way to import the other program, but when I run them both they behave like a single code, and that’s not what…
pythonasked 7 years, 1 month ago Josielho Canuto 1 -
0
votes1
answer8561
viewsRemoving Row from Nan values of a Dataframe
I joined two tables via command pd.concat and I came across the problem of there being several Nan valoes. It turns out that there are values that are missing in one of the dataframes. To facilitate…
-
0
votes1
answer85
viewsPython files
I have the following code: x=[] x=0.1 for i in range (101): x = 2.6868*x - 0.2462*x**3 I want to save my data 'x' to manipulate it into another software, I did the following: with open( 'saida.txt',…
pythonasked 7 years, 1 month ago Priscila Guedes 35 -
0
votes3
answers1234
viewsMy String is giving error "unicodeescape"
I’m trying to open a file with data .txt in Python but an error message appears. arq = open('C:\Users\Cintia\Documents\Python\Dados\lbe.txt', 'r') lbe = arq.read() print(lbe) arq.close() The mistake…
pythonasked 7 years ago Cynthia Silva 15 -
0
votes1
answer123
viewsUnidentified session in some logins on Django
I am doing a maintenance on a Django app version 1.5 with DRF 2.3. This app features off-the-shelf user authentication that works well. See a summary below: Accounts/views.py class…
python django python-2.7 django-admin django-rest-frameworkasked 7 years, 2 months ago Kaio Cesar 305 -
0
votes1
answer170
viewsParsing NLP with external list
Parsing: An input text that will go through grammar and output are all the inputs that grammar finds in the text. The problem is that my non-terminals are files from external lists and I can’t see a…
-
0
votes1
answer340
viewsPolynomial class - list assignment index out of range
Save people, I’m learning classes in python and created one for application with polynomials, but I’m not able to add two distinct polynomials, always appears the following error: File…
-
0
votes1
answer148
viewsTuples: index out of range - recursion
I have a problem with index out of range in my tuple. The purpose of the code is to create a recursive function that finds a substring inside a tuple with elements of any kind. Someone could help me…
-
0
votes1
answer384
viewsDownload an encrypted file from a url
I have this URL, it’s an encrypted Whatsapp image: https://mmg-fna.whatsapp.net/d/f/Agli1Cej_5hAtjpKhGZ3xl2TKU9dWRXcOE_k0KLvJOWZ.enc And this is the key to decrypting:…