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
answers103
viewsDjango collectstatic does not update modified files on S3
I’m using Django 1.10.6, follow this tutorial to configure media and staticfiles in S3 and when I spin collectstatic, files are not updated.…
-
1
votes0
answers238
viewsPytest-mock fixture configuration
I would like to do tests using pytest-mock. I have already run the Pip install pytest-mock command and installed it, but when I run the test below pytest can’t find the fixture. What can be? import…
-
1
votes2
answers1288
viewsHow to create 1:N relationship tables?
I’ve studied databases and understand how to diagram this type of relation, but now that I’m trying to implement this database using sqlite3 and python I’ve seen some problems. I have the following…
-
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
answer203
viewsHow to exit a timeout input in Python
I’m making a python software running on Raspberry, today it has a data input by a keyboard Matrix (https://www.adafruit.com/product/419) and another by a barcode reader, which works like a normal…
-
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
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
votes0
answers74
viewsHow to adjust my data to use in Theano?
I’m following the blog book tutorial http://neuralnetworksanddeeplearning.com/ and would like to apply the codes in my own image dataset. Since I don’t know much about python, I did some research…
pythonasked 7 years, 8 months ago Matheus Calil 11 -
1
votes1
answer275
viewsProblem with Classes and Packages in python
I asked a question but resolved to improve it to have a better understanding,and also because no one could answer the fact that little explanation in this one I will be talking about the packages or…
-
1
votes1
answer389
viewsProblem concatenating csv files
I’m trying to concatenate one CSV file with another. My goal is to remove data from an HTML daily and my routine should take a csv file called 'old data' where there is a dataframe saved in csv, and…
-
1
votes4
answers8205
viewsHow to get the highest value of a python array / vector?
how do I get the highest value of a matrix or vector? For example, in this exercise I have to make a 4x4 matrix and return to row and column of the largest element, but I stopped there. m = [] for i…
-
1
votes1
answer440
viewsWhile Exercise for Proof
I can’t do this exercise, not with while or with gone. If you can make it available to me the way it’s done with While and For,. Given a list of numbers, tell us the highest number on the list. Use…
-
1
votes0
answers34
viewsPython does not find the member "wait_read" in "Gevent.socket"
import gevent from gevent import socket from gevent.pool import Pool from gevent.event import Event . . . def __receive__(self): """ receive response packets """ while not self.die_event.is_set(): #…
-
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
votes2
answers477
viewsError trying to download python BMF zip
I am trying to download the BMF zip files at once (ftp://ftp.bmf.com.br/MarketData/BMF/), but an error appears in which the program does not find the file, however it exists. follows the code: from…
-
1
votes2
answers1752
views -
1
votes2
answers159
viewsExtracting Window and Time values from a network dump
The following network dump (PCAP format file) is the result of capturing a denial of service attack in the laboratory: I would like to extract the time (Unix time) and the window value (win) and…
-
1
votes2
answers480
viewsDeleting lines only if any cell in the worksheet is empty (using a script)
I have a spreadsheet from Calc (libreoffice)/Excel (actually it’s a text file that I opened as a spreadsheet for easy viewing) that contains some blank cells (not the entire line): I would like it…
-
1
votes2
answers324
viewsHow do I use the same argument/parameter in two different functions?
Example: def seno1(x = int(input("Entre com x: ")),n=int(input("Entre com n: "))): def cos1(x,n): How do I take advantage of the user input value of x and n in this function as well? Thank you…
pythonasked 7 years, 6 months ago Joao Carlos 11 -
1
votes1
answer112
viewsIgnore file with Python
I’m developing a client that le files .JSON and sends them to an API. Files are deposited periodically in a folder. However, what I want is that when an error occurs with the file (file being used,…
-
1
votes3
answers966
viewsHow to store an int and a complete string from within an input?
I wish that at the time of typing in the variable N the word "2 orange juice" the file stores in the variables number and food: number = 2 (preferably integer, but anything I convert it after) food…
-
1
votes0
answers38
viewsWhat is the function of pyqtSignal?
I did some research on the class pyqtSignal and its methods, but I could not understand well. Someone who works with this class, can explain to me their function?
-
1
votes1
answer287
viewsImport csv from Bucket S3
I am trying to import this a. csv file from Amazon’s S3 Bucket using the code below: import csv with open('https://s3.amazonaws.com/carto-1000x/data/yellow_tripdata_2016-01.csv', 'rb') as teste:…
pythonasked 7 years, 5 months ago Deco Padaratz 11 -
1
votes4
answers3447
viewsError while trying to write accents in Python files
I was trying to make a program in Python that could make changes to another . py file in order to change its code automatically. I went to do the following test on Shell before writing the program…
-
1
votes2
answers1123
viewsRemoving elements from a list
['# cultura de alface (parcial)\n', 'volume:5:0.25:m3\n', 'PH:7.5:0.45:-\n', 'nitrato de calcio:750:51:ppm\n', 'nitrato de potassio:500:45:ppm\n', 'sulfato de magnesio:400:25:ppm\n', 'sulfato de…
-
1
votes1
answer2013
viewsPython, how to validate if the variable is None?
I’m not able to verify if the variable has no value (None) View: endereco_id = request.POST.get('endereco_id', None) if formCliente.is_valid() and formEndereco.is_valid(): print('**********…
-
1
votes1
answer1615
viewsCan I run a Python program automatically off my computer?
Good morning guys, I made a Python script that searches various websites for the occurrences of a few words and stores in SQL database. I would like to track the occurrence of these words over time,…
-
1
votes1
answer301
viewsInput, on the same line, of a string without spaces and another with spaces
My program asks that, at the entrance, on the same line, there be a string space-free name, the name of the applicant, and a string which can contain spaces desc, the description of the deposited…
-
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, 7 months ago DaniloAlbergardi 347 -
1
votes1
answer517
viewsRead XML tag blocks based on a search
I have a folder where insert logs are stored in the database. Log files follow this structure: <item xsi:type="tns:StatusResultReport"> <id xsi:type="xsd:int">1569692</id>…
-
1
votes0
answers79
viewsPython Boundary Conditions Algorithm
I can’t run it in my python, someone who can help me? The problem is in the border conditions. for it in range(2,nt): uu=u*u; uv=u*v; vv=v*v; hbu=(h-b)*u; hbv=(h-b)*v; gh=g*h; # Avançar o sinal em…
pythonasked 7 years, 7 months ago Gonçalo Albuquerque 11 -
1
votes1
answer755
viewsGet common values in multiple columns of a dataframe?
I have a table with numerical values and would like to take the values in common in all columns (intersection) and the unique values of each using pandas (Python). Position_a Position_b Position_c…
-
1
votes1
answer45
viewsThere is Binding of data in Python
Hey there, you guys. You know some kind of Python data that you commonly have in Java frameworks, such as JSF, Spring and so on. Because I’ve used Flask and Django and I haven’t seen a similar…
-
1
votes0
answers94
viewsProblem of line breaking
My code is giving error in Presentation error Uri, which is about line breaking a = 0 p = [2,3,4,1] s = str(input()).split(" ") for k in range(4): a = a + float(s[k])*p[k] a = a/(2+3+4+1)…
pythonasked 7 years, 5 months ago Rafael Bernardo 136 -
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
votes1
answer2191
viewsEmail with Python attachment
I have a script that sends an e-mail request mirror. However, it sends the attached mirror of type . htm I would like it to send in pdf. Below is the script #!/usr/bin/env python # -*- coding: utf-8…
pythonasked 7 years, 5 months ago Fernando Júnior 130 -
1
votes0
answers111
viewsExecution of independently executed Python code
good night. I am developing a python web application with Django, the goal is to turn on and off devices using relays and Arduino, display power consumption and generated cost. I have the python and…
pythonasked 7 years, 7 months ago Wendell Mosquini Pozzatti 99 -
1
votes0
answers186
viewsPython with Django is giving problem when migrating a model
C: Python programs mysite>python Manage.py makemigrations polls Traceback (Most recent call last): File "Manage.py", line 22, in execute_from_command_line(sys.argv) File "C: Python27 lib…
-
1
votes1
answer126
viewsConnect Flask Restless API to React (Admin-on-Rest)
I’m learning to work with flask and React to create a Rest API (with flask-Restless) and a Client (with React, Admin-on-Rest). I already created the Flask Api with Reastless. I’m looking for some…
-
1
votes0
answers51
viewsSyntax Error in the list
I was doing the following exercise : "Make a program that reads 4 notes , show the notes and the media on the screen. " My show went like this : lista = [ ] i = 0 soma = 0 while(i < 3): nota =…
pythonasked 7 years, 5 months ago user158657 105 -
1
votes1
answer172
viewsTxt Manipulation - Separating blocks based on a pattern
I have a txt with some information. txt follows the following pattern: 1 - Beginning of the block 2 - Information 3 - Description of line 2 So for example 190845 3890580235203895 0329045832854880328…
-
1
votes1
answer1608
viewsHelp with Strike Match Similarity Algorithm
Friends need a help in implementing the algorithm below that looks for similarities: import nltk import pandas as pd def get_bigrams(string): s = string.lower() return [s[i:i+2] for i in…
-
1
votes1
answer1291
viewsCreate new DF based on a Pandas column
I am new in Python and Pandas I have a DF that with 3 columns, as in the example below: SRC Data1 Data2 AAA 180 122 BBB 168 121 CCC 165 147 DDD 140 156 EEE 152 103 AAA 170 100 CCC 166 112 DDD 116…
-
1
votes2
answers1755
viewsHow to select Python 3 in Visual code
I already installed the Python extension in Vscode but I want to know how to recognize the Python 3 syntax?
-
1
votes0
answers105
viewsBackground execution with Django Python
I have a web system based on Django (Python). In this app I need to show some dynamic values coming from a remote device, in which I need to place some orders every 2 minutes to log the values in…
-
1
votes1
answer15619
viewsFind an item in the list
Make a program that manages the result of the entrance exam. For your happiness, there is only one course and the course has 10 vacancies. The program must keep the list of the 10 classifieds. The…
-
1
votes1
answer988
viewsScheduling of Tasks in Django
Guys is the following, in Django things only happen when some user accesses your application. AN EXAMPLE (fictional) Let’s imagine that you created an application in which the user enters and…
-
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
votes0
answers124
viewsDestroy a container already created on Tkinter
I would like to know how to destroy a container already displayed on the screen. Like this: the program loads a container with the widgets and everything. However, when I make him create another…