Most voted "python-3.x" questions
Python 3 is the latest version of the Python programming language and was formally released on December 3, 2008.
Learn more…3,274 questions
Sort by count of
-
-1
votes1
answer1228
viewsRead fasta files in python and skip the first line
I need to read a file boredom, but I don’t know how to eliminate the first line of the sequence, example: >sequence A ggtaagtcctctagtacaaacacccccaatattgtgatataattaaaattatattcatat…
-
-1
votes3
answers646
viewsPYTHON FUNCTION(METHOD)
Well I am trying to create a register program in python, but a simple one only to test what I have learned, but I have a problem, I created a function and I return and then store in a variable but…
-
-1
votes1
answer289
viewsConsultation in public database
I need to perform queries in an online database, and turn the returned data into a data frame. I used an existing example on the database website, but I have no idea how to turn it into a database.…
-
-1
votes1
answer1178
viewsReading an XML file and printing specific fields using the Python language
I have the following XML file (actually it’s just a piece of the file): <!DOCTYPE sysstat PUBLIC "DTD v2.19 sysstat //EN" "http://pagesperso-orange.fr/sebastien.godard/sysstat-2.19.dtd">…
-
-1
votes1
answer212
viewsProblem instantiating classes in Python 3
When I run my program test.py: the debug give it back Object() takes on Parameters '' on line 4 from tatu2 import Cliente from tatu2 import Conta joao = Cliente('João da Silva', '777-1234') maria =…
-
-1
votes1
answer1399
viewsReturn an input that is inside a function
I have that code: bebidas = {'Suco de laranja': 5.99, 'Suco de uva': 5.99, 'Suco de açaí': 5.99, 'Coca Cola(lata)': 6.50, 'Vitamina': 7.50} salgados = {'Coxinha': 5.00, 'Pastel': 7.50, 'Hamburguer':…
python-3.xasked 6 years, 11 months ago Lucas Souza 567 -
-1
votes1
answer807
viewsHow to add an array within a class?
My teacher passed a paper that says the following: Create a Student class, which has as attribute a name and Cpf. Create another class called Team, which has as attribute a list of participants of…
python-3.xasked 7 years, 1 month ago Sandson Costa 509 -
-1
votes1
answer36794
viewsHow do I place items on a list in ascending or descending order?
I am trying to put the numbers of a list in ascending order but the Sort() method is putting the 10 and its multiples (20, 30) as being similar to itself divided by 10. For example, in the following…
-
-1
votes4
answers747
viewsRegex in Python to find several possible names
I need to find the name of the judge in a file of labor process, but first I need to know if he is Judge(a), Rapporteur(a), Judge(a) Rapporteur(a) or Judge(a). I’m using the following Regex: f_regex…
-
-1
votes2
answers137
viewsRead files and automatically put in the desired line;
I have several files in one folder: 01.PNG, 02.PNG, 05.PNG, some of the files do not have (04.PNG, 03.PNG). What would be the easiest way to write a text document where each file name would be…
-
-1
votes1
answer54
viewsWhy are the string characters being printed as integer numbers?
I have to analyze a code snippet and explain how it works, but I can’t figure out the output: Code: word_norm = 'mundo'.encode("utf8").lower() for idx, value in enumerate(word_norm): print(idx,…
-
-1
votes1
answer54
viewsHow do I write information on the same line without creating a new one?
I’m making a program, and I want every time the value of the variable changes, to appear on the same line and not to create new lines with the same content.…
python-3.xasked 6 years, 8 months ago Os carros são como as lanchas 1 -
-1
votes1
answer1354
viewsHow do I get value from the first line of a Text(txt) file?
So... as you can see, the variable target sets the email that will be sent the message. However, I cannot add the value of the first line of the list.txt inside the variable target. The idea of a…
-
-1
votes1
answer534
viewsI wanted to make a magic square, where I put 9 numbers, and the sum of them has to result 15 (horizontal and vertical)
Good evening guys, I have this matrix: I need the matrix numbers summed all 15. Both vertical and horizontal.. Code: import numpy as np import random from tabulate import tabulate a =…
-
-1
votes2
answers812
viewsHow do you capture two integers with space between them in python3?
I want to capture two integers, example: 2 4 exactly so in python, but it by int(input()) normal n goes, I have done so, but must have another way: var = input() lista = [] lista = var.split(' ')…
-
-1
votes1
answer255
viewsHow do I see how much the function returns Python
I made a script that returns the names of online players of a given game only that I wanted to tbm put the quantity. How would this structure for quantity return? I already tried to create a list…
-
-1
votes2
answers61
viewsPython 3 not returning float
I started to study python 3 and I was doing some exercises, until I came across something unexpected, I can’t receive a float as a response. I followed everything that was in the exercise and yet I…
python-3.xasked 6 years, 6 months ago Eduardo Reis 3 -
-1
votes1
answer882
viewsMysql + Python (Save Variable Login To Connect)
import the import getpass import mysql. class Acessdatabase(): UserName = "" PassWard = "" DataBase = "" def LoginDB(self): self.UserName = input("Username: ") os.system("cls") self.PassWard =…
-
-1
votes1
answer244
viewsCode Review: Program that simulates the "door game": either you win a car or a goat!
Write a program to simulate the door game. Make a program that has the output as the following: Hello, welcome to our program! Let’s see if you will win a car or not! Choose one door: 3 You chose…
-
-1
votes1
answer151
viewshow to make the function follow a sequence?
def fnum_aleatorio(): a=22695477 b=1 m=2**32 semente=3 num= semente num_aleatorio = (num*a + b)%m if num_aleatorio <= m//2: return 0 else: return 1 i have this function, I want it to return me 0…
-
-1
votes1
answer126
viewsList float number formatting
I have a dataframe with Latitude and Longitude columns, in string format Atibaia['LATITUDE'].head() 140 -231,124,852,387,647 245 -231,159,749,902,692 254 -23,116,747,205 512 -231,560,912,572,211…
-
-1
votes1
answer961
viewsURI Online Judge - 2163 - Python 3
I’m having trouble solving the problem The Awakening of the Force of the URI. A long time ago, in a galaxy far, far away... After the decline of the Empire, scrappers are scattered throughout the…
-
-1
votes1
answer45
viewsvariable cannot admit another value
n=int(input("jogadas:")) a=22695477 b=1 m=2**32 semente=3 i=1 num=None num_aleatorio = None lance_computador = None while i <= n: lance_jogador=int(input("Faça sua jogada")) if i==1: num =…
-
-1
votes2
answers101
viewsHow to detect if the typed string has more than 6 characters?
How do I detect that the string typed by the user has more than 6 characters for example??? . . . . . .. .
-
-1
votes1
answer679
viewsrun python on another machine
Staff it is possible to run a python script on another network machine? Example: I use the dev01 machine and I need to execute a script for collection and data on the BD03 machine both machines have…
-
-1
votes1
answer294
viewspython - Print the list elements ending with the letter 'a'
Considering the following list: lista_nomes =['Manuel', 'Laura', 'Antonio', 'Jasmim', 'Maria', 'Silvia', 'Lu', 'Pancrácio', 'Diogo', 'Ricardo', 'Miguel', 'Andre',]* What I want is to print out the…
-
-1
votes2
answers71
viewsIs it possible to manipulate the numbers of a randint?
For example, I wanted the numbers generated by a randint were 350, 400, 450 and 500. You could do that?
python-3.xasked 6 years, 3 months ago Marcos Lorhan 103 -
-1
votes1
answer33
viewsHow do I sum up the values stored in the list: pairs?
matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] pares = [] for linha in range(0, 3): for coluna in range(0, 3): matriz[linha][coluna] = int(input("Digite um valor para [{}, {}]:…
python-3.xasked 6 years, 2 months ago Fabio Canedo Leão 3 -
-1
votes1
answer115
viewsRank the contents of a Python list 3
For example I have a list [6,4,3,9,1] the answer to that would be the index of the highest value of this list in example order to the top list [1,3,2,0,4] these are the indices of where their…
-
-1
votes1
answer70
viewsHow to put a program online?
There is a shared (google) spreadsheet in which several users edit and watch it simultaneously. For those who have used the shared spreadsheet google know that when someone starts writing all see in…
-
-1
votes2
answers320
viewsI want to create a Python calculator with constructor, but when I create an object it says that the class is not defined
class Calculadora: def __init__(self, numero1, numero2): self.numero1 = numero1 self.numero2 = numero2 def soma(self): soma = self.numero1 + self.numero2 …
python-3.xasked 6 years ago ETisReal 9 -
-1
votes2
answers2194
viewsHow do I execute a command once every hour in python?
I want to run a code/line code once every hour while running the script in python, as I run every hour?
-
-1
votes1
answer2798
viewsHow to make multiple prints in the same line in python 3?
I want to know how to make prints to be shown in the same line using python 3. Example: print('1') print('2') 1 2 I wanted when python was going to print number 2, number one was erased and 2…
-
-1
votes1
answer37
viewsDoes anyone know how to use an array variable to access a position in a numpy array?
I have A=np.array([[1,2],3]) and I want to use [0,1] to make A[0,1] being [0,1] a variable. I would get 2. Somebody knows how to do this?
-
-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
answer40
viewsProgram only works once
Talk guys, I’m uncrossing python and I’m putting together a simple program that will gradually divide the modules, add treatments etc... The problem is this: in the code below, the program only…
-
-1
votes1
answer544
viewsHow to configure Raspberry Pi to run only one Python application?
I am developing an application in Python to run on a Raspberry Pi, this application will start as soon as the device is turned on. I am using the Pyqt5 to make the screens. How can I configure the…
-
-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
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
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
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
votes2
answers72
viewsWhat is the most practical way to change the sign from a numeric variable to a positive one?
That is, when the variable number is randomly generated, it can be positive or negative: I’m currently using: if number < 0 : number = number* -1
python-3.xasked 5 years, 7 months ago Vitor Oliveira 130 -
-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
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
answer1470
viewsproblems with Valueerror error: could not Convert string to float: in python
how do I convert the string to float? […
python-3.xasked 5 years, 7 months ago João Victor 39 -
-1
votes3
answers92
viewsAs I do in python for at the end of the code, it go to the start again
As I do in python to at the end of the code, it go to the start again and repeat once every 3600 seconds? My code: * fb = Facebook ( "meu-token" ) fb.testing = False try: start_time = time.time()…
-
-1
votes1
answer122
viewsProblem with excess Decimals!
Initially I was developing a python code that would help me better understand Nikola Tesla’s number theory(video). Explaining quickly, starting with 360, adding each separate value results in 9, for…
-
-1
votes1
answer222
viewsI want to scrap a page, but I can’t get a text that has " " on it
Well, the title says it all, I want to get the price of a product from the site https://www.pontofrio.com.br/, like this: <span class="nm-price-value"…
-
-1
votes1
answer110
viewsString transformation in python
'Cause this way there’s no mistake: print(f'Seu nome possui {len(nome.replace(" ", ""))} letras') But this one there: print(f'Seu nome possui {len(nome.replace(' ', ''))} letras') Python does not…
python-3.xasked 5 years, 6 months ago Fabricio Paiva 340