Questions tagged as 'python-3.x'

2
answers

How can I encrypt an input text by the user?

from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import padding from cryptography.hazmat.primitives.asymmetric import rsa #gerando a chave p...
asked by 19.10.2018 / 22:06
1
answer

Archive Keyboard Entries in Python

I am building a code to hold any command made by the keyboard, they will be published in a ROS structure topic to control a mobile robot. I'm not very familiar with Python, the most I've achieved regarding data storage was the code below ... For...
asked by 09.08.2018 / 01:56
2
answers

How do I get data from an Entry and add it to the Database (sqlite3)

from tkinter import * jan = Tk() jan.title("Dados") jan.geometry("200x200+250+100") label = Label(jan, text="Nome:") label.grid(row=0, column=0) nome = Entry(jan, width=25) nome.grid(row=0,column=1) label2 = Label(jan, text="Idade:") label2.g...
asked by 11.08.2018 / 19:09
1
answer

Pass a given sequence number of times in Python 3

I have the following sequence: {1,4,12,28,45,22} I need a variable for example: seguinte = input(num('Insira um número: ')) According to the number entered, it would pass the last item to the beginning, being informed 2 would be: {45...
asked by 13.12.2018 / 13:20
3
answers

send temp_var_node value to the MySQL database

I want to send the temperature value in OPCUA to the MySQL database, in this case the value of temp_var_node, my code is as follows: import sys sys.path.insert(0, "..") import time import datetime import subprocess import logging from opcua i...
asked by 17.08.2018 / 00:54
1
answer

How to paste a dataframe on a preformatted worksheet in Python?

I have a preformatted template in Excel that way. I would like to paste values from a dataframe into the pandas on these cells, creating a new file formatted with values and holding the original file. How do I do this?     
asked by 16.08.2018 / 19:41
1
answer

Regex words in lower case

I have a Regex that removes characters that are not letters or space, for a Python application. Ex: var = re.sub('[^a-zA-Z \\]', '', "abc Abc aBC cde123 def-ghi $?!123") Returning: abc Abc aBC cde defghi I also need to return everythin...
asked by 05.11.2018 / 21:11
1
answer

Use await with object that implements the __await__

From Python 3.5 was entered async/await I'm implementing some objects that are waiting but I'm encountering doubts follow an example: #!usr/bin/python3 # -*...
asked by 14.08.2018 / 08:10
1
answer

Calculating date with Python

I have a script that needs to make a difference between 2 dates collection of some files In case the script collects the date of a .txt file (dt_log) and the current date of the system (dt_sys) and my difficulty is to find the difference betw...
asked by 25.07.2018 / 20:12
1
answer

AttributeError: __enter__ in context manager implementation

I'm trying to understand the workings of Python's gerenciadores de contexto , implementing one based on contextmanager . Here is the script: class contextmanager(object): def __init__(self, func): self._func = func...
asked by 30.06.2018 / 22:41