Questions tagged as 'python'

0
answers

How to declare objective function in Python containing the same variable but for different intervals?

I have a binary variable x [i] [j] [t] defined in the range for i in dat.I for j in dat.I if i != j for t in range(len(dat.H[0]) + 1) I need this variable to be multiplied by a -Lambda [i] [t] parameter in a given situation and that the var...
asked by 03.07.2018 / 03:45
1
answer

Problem presenting date in QTablewidget in python with PyQt5

I have a program that shows information about products and I wanted to present the date, but when the date appears, this is what it shows: PyQt5.QtCore.QDate(2018, 7, 7) . For those who need this code here: from PyQt5 import QtCore, Q...
asked by 02.07.2018 / 13:45
1
answer

I can not render html in python 3 [closed]

I have the following app: #!/usr/bin/python3 from bottle import template, route, run import html cabeca = (''' <html lang="pt-br"> <head> </head> <body> <nav id="menu"> {{menu}}...
asked by 29.08.2018 / 07:14
0
answers

How to solve this encoding error in Pandas

I'm having a problem when python reads xlsx with the pandas. When you run des_pt = (f_pt.head()[pt][0]).encode('utf-8').strip() and put the pt variable. It has an encode problem because some characters are in utf-8. import pandas as pd...
asked by 21.06.2018 / 21:16
2
answers

How to do the input () stop after the space instead of the line break in Python3

I want to capture several numbers in this form: 2 4 5 3 5 0 4 As undefined number of numbers and without using an auxiliary list, I want to use only one variable for _ in range(0,n): num = int(input()) I only know how to create li...
asked by 18.06.2018 / 01:52
1
answer

Doubt about pycharm

I typed exactly this: import math num = float(input('Digite um numero: ')) print('A parte inteira do numero {} é {}.'.format(num, math.trunc(num))) However, when running, this only appears: Digite um numero: 9.8 Process finished with exi...
asked by 03.07.2018 / 20:44
0
answers

What is the best way to install Python on MacOS?

I have doubts about installing Python on MacOS. I'm a beginner in Python, and although I've already installed it on my computer, I still have not understood the differences in installations: - via PIP or HomeBrew commands. - by downloading th...
asked by 04.07.2018 / 04:20
0
answers

How to install dependencies for an application in Heroku?

I have some issues with implementing my application in Heroku. After adding the pipefile construct, the application has been deployed. However, I received an application error message on the site. The message on the site offers me to vie...
asked by 08.06.2018 / 17:34
2
answers

How to move multiple ZIP files at once with Python

I'm creating a function to manage files using python. I would like this function to do the following: grab all my zip or mp3 files (or other formats) and move all at once to a folder. os.chdir('C:\') shutil.copy('C:\Users\ODIN\Downloads\...
asked by 19.06.2018 / 01:47
0
answers

Error loading a video and creating an object in django

My role in Django will receive a video from my site, it is working normally. Then I created the function create : def create(self, request): Video.objects.create(file=request.data['file'], creator=self.request.user) retu...
asked by 07.06.2018 / 14:57