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
answer75
viewsRemove tags within tag using Beautiful Soup
I need to remove all span tags inside the p tags keeping their content. Html code: <p>Conceito <span>e</span> <span>Signi</span>ficado<span> </span>de…
-
-1
votes1
answer320
viewsPython - Read data to demarcation point
How to read data from a file (text or binary) up to a marked point for me in it? For example, I wrote a text and put a .(dot) that separates the first part from the second. How do I read only the…
python-3.xasked 5 years, 6 months ago RetroNietzsche 65 -
-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
votes1
answer939
viewsMeasure the use of Python code in the CPU and Memory
I have a code and I want to know how much he’s getting from the processor and the memory.
python-3.xasked 5 years, 5 months ago Igor Valadares Queiroz 21 -
-1
votes1
answer62
viewsWhat is the best way to manipulate schedules using python 3?
I have a college job to do, where I will need to create a python code that allows the user to schedule schedules for use of the institution’s rooms, but I do not know a functional way of…
python-3.xasked 5 years, 5 months ago Kirito Swd 13 -
-1
votes1
answer90
viewsHow do you order the list, no repeat numbers?
I was given this list to sort without repeating numbers. What would be the best way to do? lst = [54,54,93,93,77,77,44,44] def bubbleSort(lst1): for x in range(len(lst1)-2,0,-3): for y in range(x):…
-
-1
votes2
answers70
viewsSocket com Python
Hi, I’d like to ask for help on a project I’m doing. I wonder how I could get a python socket to "lock" a desktop program I made and only release that program for use when the server side allows.…
-
-1
votes1
answer469
viewsApplication with login and access control (Error: Typeerror: 'Nonetype' Object is not subscriptable)
I’m putting together a basic application with login and access control, that is, not all users can access the same windows. However I have a problem to load user information into the window after it…
-
-1
votes1
answer31
viewsI am unable to register the student in the list laluno, when I show the list it is empty
cad = open('cadastro.txt','w') aluno = [] laluno = [] print(""" OPÇÔES 1 - cadastrar novo aluno 2 - listar alunos cadastrados 3 - buscar aluno 4 - remover aluno """) opt = input('Digite uma opção:…
python-3.xasked 5 years, 5 months ago Alan Henrique 3 -
-1
votes1
answer216
viewsPython sort list of dictionaries by key and value in separate orders
How to sort a list of dictionaries for example: nomes = [{'nome': 'joao', 'sobrenome' 'alves'},{'nome': 'joao', 'sobrenome' 'silva'}] In alphabetical order the names In reverse order, surnames that…
-
-1
votes1
answer219
viewsHow to escape the "{" character in a formatted string?
How would it be possible to make a string that uses the . format accept the use of keys as elements of the string and not escape it. Ex: I would like the variable s: interface = "alguma" s =…
-
-1
votes1
answer33
viewsadd value to a list inside a file
I created a file inside that file has the lista["hello"] I tried to add a new item to the list with the following code import subprocess et = open("/root/projeto/a.py").read() exec(et)…
python-3.xasked 5 years, 4 months ago james lima 1 -
-1
votes1
answer77
viewsWhat is the best way to check? (Try-catch, if multiples,...?)
I am reading thousands of XML files with python. The problem is, there is not always the field in all files. resumo_cv = root.find("DADOS-GERAIS").find("RESUMO-CV").get("TEXTO-RESUMO-CV-RH")…
-
-1
votes1
answer558
viewsVscode ASCII Standard Sequences (ANSI)
I’m intending to migrate from pycharm to VS Code. It’s just that there’s something going wrong. Something that was enough as I use in pycharm to make the text more friendly, misses the use of…
-
-1
votes1
answer65
viewsUrl checks - Django
When learning to develop applications using Django it is common to get the following URL: locahost:8000/minhaentidade/deletar/id However, a malicious user may change this id and end up deleting…
-
-1
votes2
answers418
viewsname ' ' is not defined
def notas(): opcao = 0 while opcao != 5: n1 = int(input("Digite sua nota 1 :")) n2 = int(input("Digite sua nota 2 :")) n3 = int(input("Digite sua nota 3 :")) opcao = input("Deseja sair?") return…
-
-1
votes3
answers194
views"break" does not finish execution as it should
Create a program where the user can enter several numerical values and register them in a list. If the number already exists inside, it will not be added. At the end, all unique values typed will be…
-
-1
votes1
answer307
viewsInput in multiple attributes of a Python class
Hello guys I’m having a question about multiple attributes of functions or methods through the function input. For example: class Pessoa(): def __init__(self, nome, idade): self.nome = nome…
-
-1
votes1
answer40
viewsFunction that returns a new instance of a class
Can anyone explain to me why this function is not returning a new instance. It returns a monster object exactly as I want, but when the monster dies, the new instance it returns comes back exactly…
-
-1
votes1
answer28
viewsProblems in the execution of a function
I was trying to create a Python function that would display only even numbers within a range of numbers, until it works and displays numbers, but it also displays 'None' where, I imagine, the odd…
-
-1
votes1
answer140
viewsRemove text from parent element keeping daughters in BS4 in Python
How to remove improper text by keeping the title, paragraph, and link. Code: <html> <body> <header> <h1> Titulo </h1> </header> <p>Hello World</p>…
-
-1
votes1
answer207
viewsHow to use scrapy on Asp.net pages
Well folks, my question is this:: I have to download the excel file of the product that contains the description "Maíz", Product type "Los Démas. En grano." and marketing "In bulk with 15 %…
-
-1
votes1
answer41
viewsHow to use a variable as part of a command?
How can I use the value of a variable as part of a command? Example count = 1 tn.write(b'ip address 10.0.0.count 0\n') I would like the value 1 of the variable count is the last digit of the IP…
-
-1
votes1
answer26
viewsDjango Form - Status
I am working on a library administration system and at this moment I am creating the logical part to realize a loan. Here is my great doubt; How to set a state for available or unavailable book…
-
-1
votes1
answer805
viewsVBA Calling program in Python
Hello, I work for some time developing in VBA. but I’m beginning to learn Python and the following Doubt has arisen ... is it possible to unite these languages ? because I did not find anything in…
-
-1
votes1
answer308
viewsI have a Scrolledtext with Tkinter, and would like a command to fetch words that would be inside it
area = ScrolledText(jan, width=800, height=400) Here I have a Scrolledtext, which is nothing more than a text box with a scrollbar, let’s say I typed enough content inside it and would like to…
-
-1
votes1
answer136
viewsHow can I generate an Integer number in python using Random
I have the following code and I need the result to be an integer type number, but it is returning a random value (number or None) with random type (int or nonetype) from random import randint def…
-
-1
votes1
answer125
viewsIs there any way to limit the number of characters in a crypt?
I need to encrypt some database keys to decrypt in the future, but all generated messages need to be the same size. md5 has generated messages of the same size, but can not translate back (E is not…
-
-1
votes1
answer80
viewsKeras is using the entire batch at once in the fit_generator in a 3 output model
Good morning, I’m using the model available in this Git Googlenet in Keras for transfer Learning and I’m trying to adapt the fit_generator of Keras to use in the model. As can be seen in the link,…
-
-1
votes1
answer112
viewsPYTHON - JSON format HTML table data
I have the following doubt: Using Python it is possible to convert data from a table html in a format json ? HTML tablet: <div class="contentInternoSemMenu"> <table width="98%">…
-
-1
votes1
answer33
viewsMatrix in Python 3
I wanted my program to run the following. 1 2 1 3 2 1 5 4 3 2 1 And the same for any other number. My code is like this: def matriz2(num_linhas): for linha in range(1,num_linhas+1): for i in…
-
-1
votes1
answer92
viewsHow to save an input to a txt file
How can I save an input from a user that is registered in my program so that even after it closes the program and opens it again it is possible to print only that user’s input? It is possible to do…
-
-1
votes2
answers3178
viewsFormat float in Python
How should I show only two decimal places using the "float" in Python print('The average weight of these people is: {}'. format(media))
python-3.xasked 4 years, 10 months ago Sergio Campos 13 -
-1
votes1
answer328
viewsHow to increase the number of floats in python
I made a program that encrypts a message, but it doesn’t work when the message is great because the result gets big. I would like to know how to make python show me the result, no matter the message…
-
-1
votes1
answer221
viewsHow to validate if ternary operator was used in the implementation?
I want to validate through the TDD if in the implementation was applied ternary operators. How can I measure this situation? def par_impar(x): return "impar" if x % 2 else "par" Or this other?…
-
-1
votes1
answer58
viewsError in string formatting
I’m trying to personalize the spacing used in one string formatted, center to be very visual between the lines. The program is returning me value error. Follows the code: def titulo(msg): tam =…
-
-1
votes1
answer336
viewsPython: Import command gets gray in Pycharm
I need help. I’m Newbie and I’m starting to study Python with the Guanabara videos on Youtube, to then invest in an Ead platform. I installed Python 3 and Pycharm and the "import" command was…
-
-1
votes1
answer280
viewsSearch object by PYTHON class attribute
Good afternoon, I wonder if I can find an object using an attribute Example: class Pessoa: def __init__(self, nome, idade, cpf) self.__nome = nome self.__idade = idade self.__cpf = cpf pessoa1 =…
-
-1
votes2
answers74
viewsHow do I find the largest number read and the smallest number read?
How do I find the largest number read and the smallest number read? I tried the max and the min and it didn’t work. arquivo = open('notas_alunos.txt', 'r') lista_notas = [] conteudo =…
python-3.xasked 5 years, 7 months ago Pisadiasi 1 -
-1
votes1
answer94
viewsProblem aligning buttons with image, in a widget, using pyqt5 graphical library
I am trying to create a screen with a background image and two buttons (ok and Cancel) with press/drop effect using the graphical library pyqt5, of the programming language python, however, I have…
-
-1
votes1
answer77
viewsError saving an image obtained by Opencv
Directory where I need to save Banco-de-Faces\nome Directory where he is saving: Banco-de-Faces My code: cv2.imwrite("Banco-de-Faces\\" + nome + str(framesObtidos) + ".png", imagemRosto) My program…
-
-1
votes2
answers172
viewsHow to verify if Valueerror occurred
I’m trying to make a program in Python that runs a second-degree equation: and delta is less than zero (no root exite); if it equals zero (only has a root); if it is greater than zero (there are two…
-
-1
votes1
answer48
viewsPython: Return of a specific function
How can I access the function’s Return on_press(key)? The program below captures keystrokes. Open, for example, the notepad and type test and teclhe Enter The result in the list should be: lista =…
python-3.xasked 5 years, 7 months ago Wilson Junior 182 -
-1
votes1
answer52
viewsMaking a rank system
hello i am trying to create a rank system using sqlite3 and python however I am not getting anywhere,when I consult my database it returns me that: [('002', 5), ('001', 50), ('003', 80)] where…
-
-1
votes2
answers686
viewsIs it possible to input in the middle of a Python 3 print?
Something like a input in the middle of a print, it is possible? I’m trying to do something like this: print (f "Eu quero digitar {input ('')} palavras.") If I need some pygame module or whatever...…
-
-1
votes1
answer77
views*Python , discounted calculations are giving a wrong value, why?
tipo_comb = input('Digite [G} para gasolina \nE [A] para alcool: ') quantidade = float(input('Quantidade desejada: ')) cadastro = input('Digite [C] se possuir cadastro \nDigite [D] se não possuir…
-
-1
votes2
answers62
viewsfor function in Python3 - how to print all elements of a series
i = 0 for item in test['text'][i]: print(test['text'][i]) print(i) i+=1 in my dataset "test" I have 3262 items( is a series ) however when I do "for" it "printa" only 32 items…
-
-1
votes1
answer83
viewsWhere is the Output error?
I am using the Pandas library (from Python). I opened my CSV file with head function(), However, the output obtained has the data/values all together. Where is the bug/ How can I fix?…
-
-1
votes1
answer2701
viewsHow does an online game server work?
This is another question about online games, I recently studied Opengl and learned how the process of creating video games works, I was interested in learning more to create an MMO, for this I…
-
-1
votes1
answer99
viewsModules of the Python3
I’m trying to make a Scrap on a college site, I usually do in Javascript with Casperjs and even then everything ok. But now we are trying to use Python for this and I’m having problems with this…