Questions tagged as 'python'

2
answers

Iterate with two variables

I have the following code: def hasPalin(string): begin = 0 end = len(string)-1 result = "" while(begin < len(string)/2): if (string[begin] == string[end]): result += string[begin] else:...
asked by 09.08.2017 / 20:59
1
answer

Clear string in Python (remove escape characters)

I came across some strings with the following content, eg: "++++++//texto+++!!!+++//texto++++" I'm trying to find a method to clear the sentence but I'm not getting success, could anyone help me?     
asked by 14.08.2017 / 18:09
1
answer

Conditionals and Flow Control (Codecademy Python 9/15)

Hello, I'm doing a codecademy exercise and I have to solve the following conditional ones: Equal bool_one to False result or not True and True Equal bool_two to False result and not True or True Equals bool_three to the result of True an...
asked by 25.09.2015 / 14:03
2
answers

Which version of PIP should I use?

My current question is: should I use pip3 for Python3.x or can I also use pip without any problems? What are the differences between pip versions?     
asked by 30.09.2015 / 21:00
2
answers

TypeError: 'datetime.datetime' object is not callable [closed]

Python code to send sms only when the difference date of the query is equal to 7 days from the date of the current day. # -*- coding: utf-8 -*- import MySQLdb import pycurl import base64 import json import datetime date_now = datetime.datetim...
asked by 12.12.2018 / 10:19
2
answers

Run multiple processes on Linux with Python

I get some URLs as a parameter via MQTT, after extracting them I run the command for the FFMPEG to write them to the .system. But this works for just one process, and I need to run N simultaneously. I come from Java and I can not figure out h...
asked by 05.12.2018 / 17:58
1
answer

How do I call the file.setter using Python to normalize the path name

Code: class Arquivos: @property def file(self): return self._file @file.setter def file(self, arquivo): if arquivo: self._file = os.path.abspath(arquivo) Call: Arquivos.file('usp/dados.json')...
asked by 21.11.2018 / 17:09
1
answer

Problems with the 'continue' or 'while' command in Python

So I was doing some exercises in python, the language in which I'm learning to program, and it seems to me that the execution flow is not following correctly. # Converte distancia def mettocent(met): cent = met * 100 return cent def c...
asked by 21.09.2018 / 21:27
2
answers

Python, Cipher of Caesar, Strings

Hello, I would like to ask some tips to improve the code, especially in the 'geraMsgTraduzida' function, to make the code look better if it is possible. def recebeModo(): """ Função que pergunta se o usuário quer criptografar ou de...
asked by 15.09.2018 / 03:57
1
answer

Sort list with Python + Django

Good afternoon guys, I'm having a problem, I've registered for the django admin a video that should be sent to my template, but I need these videos to be sorted by the position field I have in my models.py in the bank models.py...
asked by 27.09.2018 / 16:30