Questions tagged as 'python'

3
answers

Error fetching string inside another string in python

I'm doing some testing and the code seems to be correct logically, but when I use an example: "What day is today?" as self.frase it only returns me the first if (of the hours) if I put it as self.frase="What day of the week is it today?" the sam...
asked by 09.07.2018 / 02:33
5
answers

Matrix NxM (2D) in Python with Numpy

I'm trying to solve a college activity but I could not transpose the logic into the code. The case is as follows: "The user will enter the integers in the same row separated by space. After the user passes the values, the following values will b...
asked by 16.08.2018 / 01:52
2
answers

Is there any way to receive mail through php or some other programming language?

Good afternoon everyone, I am not a professional developer, I know that in php there are ways to send email through phpmailer (), I would like to know is if there is any way to receive an email through public domain like gmail, outlook, yahoo...
asked by 18.08.2018 / 17:37
1
answer

Insert documents in MongoDB via pymongo

Good evening. I'm using python for the first time in order to run a crawler. I was able to run and get the acquisitions and I want to save them on MongoDB via pymongo. I tried to follow the official documentation but for some reason I can not. D...
asked by 17.07.2018 / 23:53
1
answer

OperationalError: near "?": syntax error python sqlite3

Good evening. I'm trying to put a pivot with the function class db(): def __init__(self,coluna): self.coluna = coluna def inserir_coluna_tabela1(self): import sqlite3 as sql conn = sql.connect('db/dbase.db'...
asked by 16.07.2018 / 04:57
2
answers

Problem when importing a class from another folder and using it. (Python)

I'm going crazy here. I'm facing a problem that should have been solved by logic already. The problem is this: I have two folders: novapasta / novapasta / classes In the first folder there is a file: novapasta / main.py In the...
asked by 16.07.2018 / 00:31
1
answer

Slice an array

I'm having problems with the values of x2 when trying to slice to display in graphic 2 nothing appears and I can not see where I'm going wrong? import matplotlib.pyplot as plt import numpy as np xold = np.random.rand() N = 3000 x1 = np.empty...
asked by 06.11.2018 / 21:12
1
answer

TimeField presentation format in Django

class Passagem(models.Model): inscricao = models.ForeignKey(Inscricao, verbose_name='inscricao', related_name='passagem', on_delete=models.CASCADE) hora_passagem = models.TimeField('Tempo', auto_now_add=True)...
asked by 05.11.2018 / 17:59
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