Most voted "python-2.7" questions
In the 2.x series of the Python programming language, version 2.7 is last and the latest. Use this tag only if the problem is specific to this version. Also use the [python] tag in your question.
Learn more…477 questions
Sort by count of
-
-1
votes1
answer18
viewsHow do I keep the word iris-setosa as text in python: df=pd.read_sql('SELECT class = 'iris-setosa' FROM tbl_iris',cnxn)
Olha o conexão já foi feita com sucesso no SQL Sever, já testei comandos como: df=pd.read_sql('SELECT class FROM tbl_iris',cnxn) ou até mesmo df = pd.read_sql('SELECT…
-
-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
answer52
viewsex de python help!
I caught it in an exercise. in the code you need to have a number n between 0 and 100 and in the next lines a variable representing how much money each one has and be printed the minimum amount for…
-
-1
votes1
answer52
viewscopy text from pygame
Guys, I’ve tried everything and I can’t copy a text from a Pygame window. The code is as follows: import pygame screen = pygame.display.set_mode((800, 600)) pygame.font.init() font1 =…
-
-1
votes2
answers260
viewsAlgorithm that creates a Python queue
Hello, I would like to create an algorithm but I don’t know much how to start it... It would be to write a program to create a queue, represented by a list, and present to the user the options to…
-
-1
votes0
answers17
viewsCan someone help me with this python code?
I need to know the functionality of this python function so that it serves what it does and needs to transform it into the PHP programming language. def word_to_int(word): value = 0 exp = 1 for i in…
-
-1
votes1
answer455
viewsCalculator in python
I had a problem trying to make a calculator in Python, the first error code in the "Userselectionselect" bool. I’m having second thoughts on how to declare a method in a dictionary. def…
-
-1
votes2
answers288
viewsMake the program go back to the beginning
I’m doing a César encryption encryption. I kind of make the program go back to the beginning. Code: tela=input('Com isso Coloque uma palavra ou frase para ajudar no comprometimentoao meio ambiente')…
-
-1
votes1
answer115
viewsError in the self.bntInsert["command"] = self command
Hello guys as I am new in python need a help in this code this with the following error File "/root/Pycharmprojects/Sistemavenda/venv/App.py", line 113 self.bntInsert["command"] =…
-
-1
votes1
answer39
viewsI cannot understand why this value is Nan in the column "[lethalityRegionalSaude]"
#letalidade por estado letalidadeRegionalSaude = [] for i in range(len(regional_saude)): letalidadeRegionalSaude.append(regional_saude.obitosNovos[i] * 100 /…
-
-1
votes1
answer36
viewsSelective and Organized Information in Python
I have two lists that send me in real time (ie every second) information if the player is online or offline. def online(nome): # aqui será armazenado o nome da pessoa que está online def…
-
-1
votes0
answers53
viewsProgram that reads 6 EVEN integer values and shows on screen in reverse order
I’m training Python and I’m having trouble with this task: Create a program that reads 6 even integer values and shows on the screen on reverse order. My current code is: lista = [] teste = 0 for i…
-
-1
votes0
answers19
viewsReturn student name in query along with matricula - python and Django admin
Base Class: class Base(models.Model): IncPor = models.IntegerField('Incluido Por', null=True, blank=True) AltPor = models.IntegerField('Alterado Por', null=True, blank=True) IncEm =…
-
-2
votes1
answer452
viewsBar graph generated with Python has become unreadable. How to improve it? How to work with a dataset of more than 1 million lines?
Friends, The following bar chart was generated (the first column of datasets is UNIX time): The Python code (version 3.5) used was the following: # -*- coding: utf-8 -*- import matplotlib.pyplot as…
-
-2
votes1
answer585
viewsAccent error in Python 2.7
During coding (below) there is an error regarding the accentuation of some words: Note: I am using Notepad++ and running python 2.7 on windows cmd Code: # encoding: utf-8 import os, sys print…
-
-2
votes1
answer65
viewstwo are in the same row within a list
guys I’m reading the book fluent python And right at the beginning I come across an instruction I’ve never seen before and I can’t find any information about it. The instruction is as follows:…
-
-2
votes1
answer67
viewsCan anyone help me find the bug? python!
in this exercise you need to find the harmonic average but it is giving error (the -1 is to stop the x and the x has to be between 1 and 10 3 and the n is the number of notes.) when it tries to…
-
-2
votes1
answer35
viewsHow to set specific directory for Render_template flask?
I am rendering an html report using the Flask render_template. By default render_template renders what is in the template folder, however, I need to change to make the directory another. I tried to…
-
-2
votes1
answer73
viewsHow to add lines from one matrix into another?
I have two matrices new_output and new_output_test and would like the matrix data new_output_test were added to the matrix new_output as the last data of this matrix. new_output Out[65]:…
-
-2
votes2
answers392
viewsconcatenate python csv files
3 lists that form the directory and the file name, I want to concatenate the files "lists_tipos_anos.csv" (around 44 files) in "lists_tipos_all.csv" (generate 4 files), where the "all" is all the…
-
-3
votes1
answer97
viewsError in def function
How can I calculate salary value with number of hours above 40 as defined in the if, I try to run with 41 hours but gives me this error salario = float(40*valor_hora+(h_excd*(1.5*valor_hora)))#valor…
-
-3
votes2
answers85
viewsI am learning Python and have an exercise using the FOR that I am not able to do, can anyone help me?
Build an algorithm that reads the age and sex of 5 people, providing: *The number of men and women; *The average age of men and women; *The greatest age among men; *The lowest age among women. This…
-
-3
votes1
answer203
viewsHow to name the indexes of an array of arrays according to another array?
Having the following array of arrays array1=[indice1[1,2,3], indice2[4,5,6]] and the second array2=['nome1','nome2'] How to make the first array (array of arrays = array1) have the same names in its…
-
-3
votes1
answer215
viewspython compiler
Good afternoon, I am developing a virtual assistant in python, which by voice command is possible to do some things. When the script in Pycharm or the same works smoothly, when running cmd on…
-
-4
votes1
answer258
viewsHow do I stop For when the range is 5?
How do I stop the For cycle when it reaches a certain condition ? For example, it would be when c equals 5. for c in range(1,10): print('a,b,c') if c % 5: break Then a function will be used, but I…
-
-4
votes1
answer2376
viewsSelenium.common.exceptions.Nosuchelementexception: Message: Unable to locate element: {"method":"id","selector":"//input[contains(@id,
When using the code: self.browser.find_element_by_id("//input[contains(@id,'seq')]") I get the error message: selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element:…
-
-4
votes1
answer57
viewsTry no for - PYTHON
Guys, how do I use Try no for? When it falls in except and the person type a string, it gives another error and terminates the program, in while I can use normally. I tried using a for loop with…