Questions tagged as 'python'

2
answers

name is not defined - name / variable not defined, tkinter and slite3 help

I'm starting to study sqlite3 on the go, and this is difficult, but I've already got some things, the problem is that when compiling the program the following error appears: "name 'adic' is not defined". Follow the code: from tkint...
asked by 09.08.2018 / 05:12
3
answers

How to add values from a json request in python?

Example: request = requests.get('https://api.amountofsomething.com') amount = request.json()['amount'] This request returns values like these: [{"amount": 0.1}, {"amount": 2},{"amount": 145},{"amount": 5.84}] I need to make sums, witho...
asked by 09.08.2018 / 20:10
1
answer

Python utf-8 encoding error

Hello everyone, I'm new to Python programming, I'm creating a program that reads information from a text and transcribes elsewhere. Apparently the text was working normally on the computer, I uploaded all this information in github , wh...
asked by 18.12.2018 / 20:11
3
answers

Remove comment tag and its contents in Beautifulsoup 4

How do I remove the comment tag along with its contents with bs4? <div class="foo"> A Arara é um animal voador. <!-- <p>Animais Nome: Arara Idade: 12 anos e 9 meses Tempo de Vida: 15 anos --> </div>     
asked by 27.12.2018 / 17:56
1
answer

How to write CSV file data without deleting existing data

I need to save data to a CSV file without deleting the data already in the file, just create a new line with the entered data material=str(input('Informe o material: ')) mod_elasticidade=float(input('Informe o modulo de elasticidade do mate...
asked by 29.06.2018 / 05:00
2
answers

How do I assign the last value of a vector to a variable?

I need to put in a variable the last value of a vector, problem is that this vector can vary in size. Is there any direct function that brings the last value of the vector? I tried to use a variable to check the size of the vector, but it did...
asked by 28.06.2018 / 13:17
2
answers

Function remove in a list changes elements in another Python3

def almostIncreasingSequence(sequence): x = sequence for i in range(len(x)): sequence = x cont = 0 y = False sequence.remove(sequence[i]) for j in range(len(sequence)): try: if sequence[j] < sequence[j+1...
asked by 11.07.2018 / 01:09
1
answer

Why are you playing the Windows error sound instead of the specified file?

import winsound winsound.PlaySound('C:/Users/Computador/Music/Action!/som1.wav', winsound.SND_ASYNC) When I run this script it does not touch the som1.wav file, but rather the Windows error sound. Why?     
asked by 03.08.2018 / 01:27
2
answers

Indicate if a character is a vowel or a consonant

Write the vowel function that receives a single character as a parameter and returns True if it is a vowel and False if it is a consonant. Notice that vogal("a") should return True vogal("b") should...
asked by 29.07.2018 / 13:42
1
answer

Convert data frame pandas to array

I have a data that, from .txt, converted to a Dataframe (DF) with pandas. For the various activities that I realized it is very convenient that it be a DF. There is only one column with values besides the index. Now, I would like to...
asked by 03.09.2018 / 02:42