Questions tagged as 'python'

1
answer

How to copy a .txt file that updates the name daily - Python

I need to copy a TXT file daily from one folder to another, but the file is renamed according to the date, the end after the "_" always changes with the date value. Ex: _20181205.txt , _20181206.txt , _20190101.txt . Bel...
asked by 05.12.2018 / 14:03
1
answer

Inserting a JSON object into a JSON field in PostgreSQL with Python

Good morning, I have the following problem, I made a crawler and it receives the information, but at the time of formatting it in json format and inserting into the database it presents error. Follow the Code: valor_coleta = "3,5%"...
asked by 05.12.2018 / 14:21
1
answer

fetch api GET method with Django

I'm trying to do this with ajax, but it always returns form , it follows my line of code: / p> recovery-id.js: const recoveryButtom = document.querySelector('#recovery-id'); const inputs = document.querySelectorAll('input'); r...
asked by 03.12.2018 / 14:10
1
answer

python count of different words with only one counter?

I have this code: palavras = dataClean.split() count = 1 for palavra, frequencia in palavras: aleatorio = random.uniform(0.0, 1.0) if aleatorio < 0.5: count += 1 contProb[palavra] = count count = 0 print(contProb)...
asked by 16.12.2018 / 02:38
1
answer

Problems with utf8 encoding in python

Error getting script: Igetthiserrorbythenamethathas~thatreturnsfromthemysqltable.Ifthe~tableinthetabledoesnotgiveerror,ifyouput~Igetthiserror.Myscript:#!/usr/bin/envpython#coding:utf8importMySQLdbimportpycurlimportbase64importjsonimportdatet...
asked by 14.12.2018 / 15:19
1
answer

Python: Tkinter + SQLITE. Save records to database and clear field

I'm studying, on my own, SQlite, I've already bought some courses, but I need some help. Purpose: I would like to save the user-entered fields in the database and then clear the same fields to allow new data entries. The program is a wind...
asked by 20.11.2018 / 13:25
1
answer

How to plot a graph when closing a computer view script on Raspberry pi?

I have a code using opencv Raspberry Pi and it is executing a loop pattern recognition, in the end I close the script using "Ctrl + X", without any problem! I want to by "stop" the graphics processing, perform a function to plot the recognition...
asked by 31.05.2014 / 00:15
1
answer

Python setar String where the cursor is [closed]

Good afternoon I need to set a string where the cursor is stopped. Examples: - Blinking cursor stopped on a notepad, I play a string in notepad. - Blinking cursor stopped in any typing field, I set a string in the typing field. How can I d...
asked by 27.11.2018 / 17:52
1
answer

How to send images via socket in Python?

So there's the server: import socket from PIL import Image port = 8000 host = '127.0.0.1' s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((host, port)) s.listen(5) while True: conn, addr = s.accept() print('Conectado a...
asked by 14.11.2018 / 03:08
1
answer

Averages of elements in several lists

I need to calculate the sum of several elements in different lists (from index 0). lista1 = [154,12,998,147] lista2 = [897,123,998,59877] lista3 = [3,789,111,555,699] This would be the simplistic way: soma = lista1[0]+lista2[0]+lista3[0]...
asked by 13.11.2018 / 20:27