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
votes0
answers45
viewsThis error happens when I run the program on Ubuntu, and Win10 works normal. What to do?
Program def trabaLinhas(caminho): colunas = extraindoZip.listaArq(caminho)[1] dadosV = pd.DataFrame(columns=colunas) for coluna in colunas: listaLinhas = lerTxt(caminho, coluna) dadosVazao = []…
-
1
votes2
answers15896
viewsHow to stop an execution in Python?
I’m starting programming in Python and would like to know how to stop the program execution? In the language C for example, there is the equivalent command system("pause"). If I open IDLE, more…
-
1
votes1
answer28
viewsReferences not available in the final program
I’m validating some functions created in python, I have a code that creates some functions. When running the program with the functions (test_client.py), I get an error. auth_utils.py: from hashlib…
-
1
votes1
answer168
viewsCannot import urlencode name on program run
I need to run a routine, but system informs that it cannot load the name urlencode (I don’t know if I can call this function, class), I searched for similar libraries, but I’m also not sure I’m…
-
1
votes1
answer784
viewsReact Native installation error
I am trying to configure the environment of the Active Act on my computer. Able to install the choco package manager. But when I try to install python2 with the command: choco install python2 this…
-
1
votes1
answer264
viewsExtract data from a calendar with Python and Beautifulsoup (under Linux Ubuntu-like)
Friends, I’d like to take data from a calendar: http://www.purebhakti.com/component/panjika The first step would be to make the program choose the time zone ( -3:00 Buenos Aires) and click on Submit…
-
1
votes1
answer1336
viewsPython data extraction and automatic email sending with information obtained
Friends, The data extraction part is working and the email sending is also in part. I would like the same information that I print on screen and with the same formatting (skipping line etc)) to be…
-
1
votes1
answer449
viewsHow to select and print a value within a list created by a "def"
The title is already self explanatory, as I do to select and choose given str or int float/ inside a list that was created by my record function def registro(cadastroaluno): matricula =…
-
1
votes1
answer262
viewsPython returns "Dead" when trying to read json > 240mb
The problem occurs on a Centos server version 6.8 final. The same script with another smaller file works perfectly. Test performed in Ubuntu 16.04 the process occurs successfully. Any solution?…
-
1
votes0
answers279
viewsEncode error - python 3.6
Traceback (most recent call last): File "uns.py", line 64, in <module>expiration_date="2017-08-27", File "uns.py", line 53, in create_user print(response.text) File…
pythonasked 7 years, 9 months ago Eduardo Pessoa 123 -
1
votes1
answer1559
viewsHow to print a. txt file in Python
I try to print that part of my work into a file. txt (code below), but I can’t, because at the time of giving Run in the file that whole part comes out blank: It is worth mentioning that even…
-
1
votes1
answer384
viewsHow to capture the query string of a Restful request
I need to get the parameters passed by the URI, for example: http://localhost/endpoint/param1/param2/param3 if param1 == "adduser" id = param2 name = param3 Example of a function that did not work:…
-
1
votes1
answer1548
viewsCondition python Matrices
My Code: m1 = [[1, 2, 3], [4, 5, 6]] m2 = [[2, 3, 4], [5, 6, 7]] def soma_matrizes(m1, m2): matriz_soma = [] linhas = len(m1) colunas = len(m1[0]) for i in range(linhas): matriz_soma.append([]) for…
-
1
votes1
answer677
viewsIs using "if/Elif/Else" with Return good programming practice?
Ex.: return (sum*2 if a == b else sum)
pythonasked 7 years, 7 months ago Gabryelle Soares 11 -
1
votes1
answer762
viewsList only files without folders in Python dirétorio
I need to list files in a directory, but I need you to list only the files, without showing any folder if you have in that directory. I used: import os print os.listdir('/')…
-
1
votes2
answers19135
viewsSyntax = Invalid Syntax for variable name
LadodoQuadrado = input("Digite o valor correspondente ao lado de um quadrado: " variavel = float(LadodoQuadrado) x = LadodoQuadrado * 4 y = LadodoQuadrado ^ 2 print("perímetro:", x, "área:", y) When…
-
1
votes1
answer979
viewsSending POST with Python via Curl
I want to turn the form (which is working) into a URL to run in the backend <form action="/users/login?ssrc=head&returnurl=https%3a%2f%2fpt.stackoverflow.com%2f" method="post"> <input…
-
1
votes3
answers691
viewsPython 3.6 regular expression for inteitra phrase extraction
I need to extract only the phrases that contain ADMINISTRATION - JUDGE OUTSIDE - NOCTURNE - SISU - GROUP B, for example. That is, I need to get only the name of the course, the city, the turn, the…
-
1
votes1
answer2606
viewsHow to format float and range input in Python 2?
I need to make an average calculator (student grades) where the entries have a decimal place and are in the range [0, 10]. The exits need to present five decimal places and so far, with what I’ve…
-
1
votes1
answer99
viewshow to give two splits on a txt
I want to give two splits one to delete lines from txt and another to delete his tab in txt has name:last name ex Rafael:File the tab and ":" how can I do this?
pythonasked 7 years, 7 months ago Adriano guedes 149 -
1
votes5
answers12449
viewsHow to separate a digit from an integer?
For example, for the program to tell the number of the hundreds of a number from: número_int = int(input("Digite um número inteiro: "))
-
1
votes2
answers534
viewsHow to run a loop until the lines of a given.txt file end
I would like to make a basic loop system for example, open the file that the user typed then use an if for while having lines in the file run a loop with other code
pythonasked 7 years, 7 months ago joao mello 13 -
1
votes1
answer1160
viewsFind equal values between 2 columns of . csv and refresh another column X
Hello, I have two files . csv as below: .csv1 POS,ID 28000167,. 28000263,. 28000484,. 28000711,. 28000728,. 28000885,. 28089922,. 28089927,. 28090173,. 28090325,. 28090326,. 28090331,. 28090415,.…
-
1
votes2
answers795
viewsRead files . CAP efficiently with Python
I have some. CAP files originated from catching packages with tcpdump. When trying to open with wireshark, the machine gets very slow, because I imagine he tries to load everything to RAM. I would…
-
1
votes2
answers166
viewshelp with indentation that is generating error in python 3.6
I’m doing a webcrawler I’m having the following problem. I had to do a separate program to print out how many candidates passed each course. Only that the last line is not running, and it would make…
-
1
votes1
answer39
viewsBuild Java code using Python
I want to create a python script that given a name of a JAVA function looks for it in a library and copies it to another file. Is there any way to search for JAVA functions (providing the name)…
-
1
votes3
answers3909
viewsHow to install pytest in windows 10 - 64 bits, python3
I need to install pytest, it was suggested that I run the command on cmd: Pip install -U pytest but of error: 'Pip' is not recognized as an internal command or external, a operable program or a…
-
1
votes1
answer119
viewsHow to make a "time-Slice" in packages in a network dump with Python?
I’m trying to "grab" source Ips and target Ips inside a network dump (PCAP) file. The idea is to save all source Ips and all target IPS by scanning the file every 10 minutes ("time-Slice"), for…
-
1
votes1
answer813
viewsRuntime Error in Python
I made a backtracking program in Python to find a set of M-sized binary strings where any string has a distance greater than d to any other string in the set. But it does not work well when I test…
-
1
votes1
answer485
viewsDjango without models view in common user admin even if you have permissions and are in the same group
Good afternoon, So I’m trying to give permissions that already come in Jango to an ordinary user who even belonging to the group cannot access the models that are granted to him. Someone had this…
-
1
votes2
answers4092
viewsHow to convert a list to string and vice versa?
I have a list: ('47075', 'josenestle', 'i need help') I do str1 = str(list) and have it in string. However if you do list(str1) I do not recover my list. I find no obvious solution, help would be…
-
1
votes2
answers2406
viewstxt file for python list
I have several files with values of the form: 0.4350 0.8798 0.0099 1 0.4375 0.8674 0.0090 1 0.4400 0.8682 0.0082 1 How do I load these Python files in the form [[0.4350, 0.8798, 0.0099, 1], [0.4375,…
pythonasked 7 years, 7 months ago Hugo Azevedo 61 -
1
votes3
answers4236
viewsHow to open . txt files in Python?
I want to open a. txt file for reading but python always gives error, want to use f = open('ficheiro.txt', "r") or f =open('C:\...(diretório)...\ficheiro.txt', "r") I’ve already created files from…
pythonasked 7 years, 7 months ago Hugo Azevedo 61 -
1
votes2
answers856
viewsDatabase graph does not show python matplotlib
The sketch of the graph appears, but empty , with no data. import sqlite3 import matplotlib.pyplot as plt import matplotlib.dates as mdates connection = sqlite3.connect('escola.db') c =…
-
1
votes0
answers3514
viewsPYTHON - Difficulties in arranging COH-PIAH code
Good evening, I’m doing a course in python and this is the last exercise of the course, but I’m having a lot of trouble correcting it, when I send gives the following error: "***** [0.5 points]:…
pythonasked 7 years, 7 months ago Junior de Paula 11 -
1
votes1
answer1113
viewsCompare all Rows and Columns of two Df, update and add differences at the end of Rows and Columns
I have two csv separated by tab. Both have the same number of Rows and Columns. The first column POS has the same Unique values in both df. Differences (or not), occur in the values (strings) of the…
-
1
votes1
answer1390
viewsDjango, recover selected value on page
Good night! I created a view where I recover the sellers and created a variable (id_seller) to receive the selected seller on the screen. html is being created correctly, but the variable in the…
-
1
votes1
answer62
viewsPython - How to get driver names C: D: F: I:
I’m developing a GUI in Python 3.6 using TKinter. I have reached an impasse where I have to get the letters of the installed drivers and their names the same way they appear in Windows Explorer. See…
-
1
votes1
answer154
viewsSiri Voice Command Manager
I know my Macbook has tts (text to Speech) when typing command Say. I wonder if there is an API or library that works with this in python. Or you would have to do it manually? Anyone recommend…
-
1
votes1
answer477
viewsWeb scraping at a specific url with Beautifulsoup
from bs4 import BeautifulSoup import requests import re url = 'http://www.bhaktiyogapura.com/2017/03/calendario-vaisnava-marco-de-2017/' header = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64;…
-
1
votes3
answers181
viewsDifference between two codes
Code 1, if variable num is 1 or 2, for example when the conv() is called again and I choose option 3 to exit then wheel the print I hope I have been helpful (: but the program does not close, only…
-
1
votes2
answers700
viewsAdd the results for x in range
k=5 for k in range (5,10): print(2*k**2) 50 72 98 128 162 I need to add these results.
pythonasked 7 years, 6 months ago Rafael Uemura 21 -
1
votes2
answers1083
viewsSort a. csv file from the numeric column
I have the following file: es;548 la;1832 primera;35 vez;107 que;2598 hago;15 un;878 pedido;642 y;1713 creo;83 ha;207 funcionado;1 muy;371 bien;257 los;1054 precios;88 fuesen;11 And I’d like to sort…
-
1
votes4
answers11441
viewsA list to receive 20 whole numbers and store in a list and print the largest element in the list
n = int(input("digite o número : ") I=0 For i in lista: lista[i].append(input("digite o número" I+=1 else: Print("lista cheia") I’m new to Programming and I can’t implement what the questionnaire…
-
1
votes2
answers1547
viewsAnalyzing strings in a text file and returning the string that appeared most
I need to analyze strings in a text file and return to the one that appears the most (if there is a tie take both) and save in another text file. I open the file and analyze the lines but I do not…
-
1
votes2
answers684
viewsTkinter - How to save Entry() string
I have a problem about Tkinter, I am not able to save the value of an Entry() in any variable, so as soon as I can use the name of that file to create a TXT. Follow the code: def criarPL (): global…
-
1
votes3
answers243
viewsPython "list out of the range"
I’m trying to put two columns of data, each in a different file with the names you’ll see in the code, in a single file as two columns side by side. The error, quoted in the title ("list out of the…
pythonasked 7 years, 8 months ago Anderson Costa 15 -
1
votes2
answers397
viewsCalculate how many Nan in each Python time
Good day, I have one DF where it has NaN And I need to count how many Nan I have at every hour. My df has a 31-day period. I believe I should use Groupby, but I’m not finding a way. import numpy as…
-
1
votes2
answers897
viewsHow to delete an element from an Array String?
I’m having the following build error: del(alimentos[i]) TypeError: 'str' object doesn't support item deletion What did I do wrong? I would like to remove the typed item from the list. My code: dieta…
-
1
votes1
answer535
viewsPython - Tkinter Module
I’m almost done with this little program, but what’s happening is this: in the "Tools" tab creates 2 submenus, in which I wanted to add submenus inside other submenus, I know it’s possible, but I…