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
votes1
answer907
viewsNameerror: name 'Y' is not defined
So I’m trying to make a very simple calculator, (one of my first "projects"). In this calculator you need to choose an operation. Each operation has an associated number, and I use if and Elif to…
-
-1
votes1
answer1549
viewsHow to get the last update date of a python file
I would like to know how I can get the full date (day/month/year and time/minute/second) of the last update of an excel file?
pythonasked 5 years, 11 months ago André Felipe Jardim Firmo 127 -
-1
votes1
answer1415
viewspython stopwords
Is there any way stopword without using the import nlkt? I’m searching the web but I’m not finding another way. I can’t install the nltk in my 64-bit Python 3.6. I follow all the steps, but finished…
-
-1
votes1
answer30
viewsvalidation error in Protorpc
I’m getting some errors from Proto-C when I try to use endpoints. My code: class Application(EndpointsModel): _message_fields_schema = ('id', 'nome') criado = ndb.DateTimeProperty(auto_now_add=True)…
pythonasked 6 years, 4 months ago user117327 -
-1
votes1
answer337
viewsIncrease Spirograph Loop Speed in Turtle
Using these references: Spirograph Patterns and python 3.4 Spirograph error the following code has been created: Code import turtle import math import random def Xcord(R,r,p,t): return (R-r) *…
-
-1
votes1
answer644
viewsError using chatterbot in python ('chatterbot' is not a package)
I made a basic code of Chatterbot in Python that ran well, but suddenly stopped working and always presents the same error: from chatterbot.trainers import Listtrainer Modulenotfounderror: No module…
-
-1
votes1
answer1818
viewsError presented in vscode when trying to run a Python code
Person, I’m trying to run some scripts on Python, however in terminal of vscode is being showing the following error: bash syntax error near unexpected token (' This error is only happening on the…
-
-1
votes1
answer297
viewsTkinter library not recognized by Pycharm
I am importing the Tkinter library into Pycharm, but Pycharm is not recognizing its functionality, not running and showing error. I attached the image of the error presented for aid.…
-
-1
votes1
answer401
viewsHangman Game - Hit Check
Guys I’m having a problem to finish the frock game in Python, I’m not able to do a scheme to check if the letters were right and or wrong, could help me? from random import randint lista_palavras =…
pythonasked 6 years, 4 months ago Maycon Willian Alves da Silva 75 -
-1
votes2
answers587
viewsConvert number to hours in python
How to convert a 1234 number representing houras to a string with time format e.g. 12:34 in python?
-
-1
votes1
answer1188
viewsCreate a python routine that runs a script every 30 min
I created a code that copies a file from one folder and moves to another, but I have files every 30 min and I need this script to run at that time too.
pythonasked 5 years, 10 months ago user135841 1 -
-1
votes1
answer1673
viewsRead . txt file and write each line in a variable - Python
Good afternoon, you guys! I’m having trouble recording each line into a variable to be used in a for. In my file . txt has a list of several contacts, e.g.: [email protected],…
pythonasked 5 years, 10 months ago Andre Batista 41 -
-1
votes1
answer29
viewsHow to add multiple column content
Based on csv year columns, Month, day, hour, minute how to add to a single column? df['date'] = pd.to_datetime(
-
-1
votes3
answers2192
viewsPut only True and False in if and while
I wonder what that’s for: if true: #Código or if false: #Código or while true: #código etc..…
-
-1
votes1
answer178
viewsThe code does not work as expected. (python and kivy)
I cannot change the name of Label 1 or Label 2 through the click function. The program shows only "hi" on the console. Python code: import kivy kivy.require("1.9.1") from kivy.app import App from…
-
-1
votes1
answer405
viewsHow to fix: Object has no attribute, in python?
I’m new in python and I don’t understand this attribute error that he talks about. For me the code is correct. class Notebook: def __Init__(self): self.__notes = list() def storeNote(self,note):…
pythonasked 5 years, 10 months ago Timóteo A. Cruz 1 -
-1
votes1
answer51
viewsproblem when using text to Speech in python, problem with windows path
I followed this tutorial: https://cloud.google.com/text-to-speech/docs/quickstart-client-libraries?hl=pt-br#client-Libraries-install-python To do python convert text to speech Everything went well,…
-
-1
votes1
answer1633
viewsRun python script on android via one-click file extraction
Talk to me guys, How do I convert a script made in python to run on android? My script is very simple, only to extract a file that will always stay in the same place, do not need a graphical…
-
-1
votes1
answer68
viewsError in Fortran
I have this programming in Python: from time import sleep #importando biblioteca para usar a função sleep G = 6.67408 * (10 ** -11) M1 = 1.98*(10**30) Xo = 15 * (10 ** 10) Yo = 0 Voy = 2.97 * (10 **…
-
-1
votes1
answer42
viewsRead XML file with Argparse and convert it to JSON
Hello! I have a question and I am very new in the subject: I need to create a Python code that reads a file XML and turn that same file into a JSON. I need to use the Argparse for that, but I’m not…
-
-1
votes1
answer349
viewsHow to change the month of a datetime object in pandas?
good afternoon, I have a column of the pandas dataset for the month of September whose . head() is: [in] :df_setembro.head() [out]: 0 01/08/2018 1 02/08/2018 2 03/08/2018 3 04/08/2018 4 05/08/2018…
-
-1
votes1
answer47
viewsHow to find a Select without ID or NAME field
I have a test project where I have to perform some Inserts in the form and validate if everything is flowing well, but the Dev who created the form did not put select as follows: <select id=""…
-
-1
votes1
answer232
viewsExtracting information with Python
I’m conducting some tests with Python and would like to extract some data that are presented on the page of "System information" in the Windows. I know the library "os" of Python allows us to…
-
-1
votes2
answers94
viewsError closing browser in Selenium-webdriver
Code: firefoxbin = os.path.abspath(os.path.join(os.path.dirname(__file__), 'drivers', 'geckodriver')) assert os.path.isfile(firefoxbin), "Driver \"{}\" não disponível.".format(firefoxbin)…
-
-1
votes1
answer832
viewsHow to update lines with open() in python?
the Python open() method has functions to read and write but there is no update, as I can do?
-
-1
votes2
answers4651
viewsFrom a list, return even numbers in python
I am trying to return only the even numbers of a list1=[4,3,2,5,7,6] for the return in a Lista2=[2,4,6] I tried the recursive method with for but returns the error: Typeerror: Unsupported operand…
-
-1
votes3
answers1053
viewsProblems in Try (Python)
When I use Try and put 3 operations, if the first one goes wrong it already goes pro except. Is there any way to "improve" this by making it jump to the next action? Can’t make a code where there’s…
-
-1
votes1
answer151
viewsUncompromising a CSV file import using Pycharm
Good night, I want to import an excel file, and then I can manipulate it, but when I import the spreadsheet into Pycharm the file is all disfigured. Can someone help me? The following text is…
-
-1
votes1
answer77
viewsString methods - isdigit and isdecimal
The method 'str'.isdigit() will always return the same T/F as isdecimal() or there is some difference in the algorithm of these methods?
-
-1
votes1
answer406
viewsReturn the first 5 items from a Python list
Given the list below: list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Is there a quick way to get the top 5 items on this list? Something like list.get_first(5)?…
pythonasked 5 years, 8 months ago Thiago Krempser 1,878 -
-1
votes2
answers534
viewsCheck if a sequence of numbers is present in another
I have two numerical sequences that have some similar digit sequences. a = 0000000724050613 b = 07240001980055060113 Example: the sequences 724 and 506, for example, they are contained in a and b I…
pythonasked 5 years, 8 months ago Antonio Braz Finizola 391 -
-1
votes1
answer169
viewsraise Valueerror("Unknown url type: %r" % self.full_url)
I’m trying to create a tool that opens a URL along with /robots.txt and return what is written on it, code: site = input("Digite o dominio:") api = f'{site}/robots.txt' pagina =…
pythonasked 5 years, 8 months ago user142219 1 -
-1
votes2
answers105
viewsHow to perform a function several times simultaneously?
What my code does: import time def oi(): while True: print("oi") time.sleep(1) oi() Output (in 2 seconds past): oi oi What I want you to do: import time import multiprocessing def oi(): while True:…
-
-1
votes1
answer100
viewsSyntax error in a beast program in Python
modo = int(input("Selecionar modo de jogo: ")) if modo == 1 print("deu 1") if modo == 2 print("deu 2") I just wanted to test if the user, when typing 2 the program prints 2 and the same pro 1, but…
-
-1
votes1
answer139
viewsHow to download an image using Pillow(python)
I wonder how I can choose where my arquivo.png will be saved using Img.save()
-
-1
votes1
answer137
viewsHow to run this script in a more sophisticated way?
Good morning. I am using this code to update the firmware of my company’s servers. However, I wanted to use this same code to update a list of servers, not just one. Follow the original code:…
-
-1
votes1
answer558
viewsHow to split a 3-letter string
If anyone can help me I’m making a program in python 3 similar to those binary code translators, Base64 etc I’ve done what will turn words into code now I want to make the program that will turn the…
pythonasked 5 years, 8 months ago Daniel Andrade 3 -
-1
votes1
answer278
viewsHow to open multiple HTML’s and save content sequentially in a txt
I need to open several HTML’s, get their text and save to a txt sequentially, but I don’t know how to do that. I can do this with a single HTML, but I need to do it with several, and sequentially.…
-
-1
votes1
answer596
viewsPython imports not found
I am facing some problems with downloaded Imports with pyPI, more specifically Imports Pypi Wikipedia and Google... I install both via Pip install and they can be found in the site-Packages folder…
-
-1
votes1
answer192
viewsRun language file c in Python sricpt
I have an analog data acquisition file converted to digital values (in this case the temperature value of the LM35 sensor) with ADC Maxim 1203, I would now like to call the file in a Python script…
-
-1
votes3
answers550
viewsInput jumps line, how not to jump in Python?
How do I use input and prevent it from skipping a line before the next one in Python? for example: Digite N: 1 Digite dígito para A: 5 Digite dígito para E: 9 Digite x: 8.25 Digite y: 7.3 Errou…
pythonasked 5 years, 7 months ago Tiago Rasses Ras 1 -
-1
votes4
answers17442
viewsPython sum operation
Can someone explain to me how you make the sum of two integers between them, that is from the first number to the second number (which is not included)? Here is an example: numero1 = int…
pythonasked 5 years, 7 months ago user143390 -
-1
votes1
answer218
viewsPython - Strings and files
I’m starting to learn Python files. What suggestions would you give to improve the code and make it more beautiful or smaller? """ A ACME Inc., uma empresa de 500 funcionários, está tendo problemas…
-
-1
votes1
answer55
viewsWhere can I find Python’s methods?
Hello, I’d like to see how the default python methods are written, such as str.split(). I have looked in the folder where python was installed but could not find it. I wonder if you can see.
pythonasked 5 years, 7 months ago Rafael Nobre 1 -
-1
votes1
answer30
viewsSpawn of midi python notes
i want to create a game style Guitar I made a prototype in Blender I used as a base a course of Infinity Runner in Blender, I would like to create a Pawn of notes that are contained in a file.midi…
-
-1
votes3
answers229
viewsPython is not so "smart" for redundant operations
Unlike many cases in c++, Python is apparently not so smart to optimize redundant operations, even between constants. I made a simple benchmark to test math.cos inside and outside a loop. In this…
-
-1
votes1
answer46
viewsEdit a list that is inside another list
I need to split the list inside another list. lista = [ [Temperatura final = 250 k], [Temperatura Minima = 120 k], [Temperatura Maxima = 310 k] ] Get the final result listafinal = [ [Temperatura…
-
-1
votes1
answer53
viewsHow to create a trigger to detect that a variable has changed value within a loop?
would like to know how I can create a trigger to rotate a function only when a specific variable changes value within a loop, only without needing to define a variable outside that loop, for…
-
-1
votes2
answers437
viewsIs there a way to center the screen created in python ( pyqt ) for any resolution?
I’m doing development of an application in python and Qt, ie pyqt5 and I wonder if there is a way whenever I run the display I created centralize on the screen, I saw that has to do this manually…
-
-1
votes2
answers750
viewsConvert a byte variable into a string?
Good afternoon liked to convert a byte variable into string. I have the following code; print(str.encode(frase)) which gives the following output; b'Ola' and wanted before; Ola I found a way to…