Questions tagged as 'python'

2
answers

Show fields of related models in the django template

I have these two models, Invoice representing an invoice e Item that represents the items on the invoice. from django.db import models # Create your models here. class Invoice(models.Model): vendor = models.CharField(max_len...
asked by 24.12.2015 / 21:17
1
answer

How to make the fields in a table fill by default with values from another table?

This is my billing table db.define_table('facturacion', Field('numero_comprobante', 'string'), Field('numero_cotizacion', 'reference cotizaciones'), Field('cliente', 'reference clientes'),...
asked by 07.01.2016 / 22:04
1
answer

Obtain the object of a foreign key in Django

I have these models: class Direccion(models.Model): pais = models.CharField(max_length=30) estado = models.CharField(max_length=30) municipio = models.CharField(max_length=30) ciudad = models.CharField(max_length=40, null=True,...
asked by 17.01.2016 / 03:14
1
answer

Call different version of Python on the Windows terminal?

I wish I could call any version of Python that I installed on the Windows terminal (I have 2.7, 3.6 and 3.7). I would like to call you with python , python36 and python37 or in any other way if you have more relevant ideas. H...
asked by 14.12.2018 / 11:51
3
answers

Interactive Mode V / S Ide Python

One question; Why do I do this in interactive mode from python and from "spyder / ninja" does not work? Python »> from numpy import * »> a = array([10,20,30,40]) »> append(a,50) array([10, 20, 30, 40, 50]) »> Spy...
asked by 21.06.2016 / 00:14
2
answers

Separate elements from a list identifying a set of letters

First of all, I apologize for the title of the question, which is not clarifying. I have a list with the names of several files in a folder, of the type: file1_A1, file1_A2, file2_A1, file2_A2, ... How can I create two lists from this list...
asked by 30.05.2017 / 22:09
1
answer

Create temporary file in memory

I would like to know if there is a way to make a file saved in memory without having to write it to disk. for example: imagen = wx.Bitmap('imagen.png', wx.BITMAP_TYPE_ANY) Now I want to take the image data and save it in memory, wx.Bitmap h...
asked by 04.12.2018 / 14:42
1
answer

Character error in Python3

I have problems when executing the following code in Python: #!/usr/bin/python # -*- coding: iso-8859-15 -*- import os, sys sara1 = '░█▀▀▀█ ─█▀▀█ ░█▀▀█ ─█▀▀█' sara2 = ' ▀▀▀▄▄ ░█▄▄█ ░█▄▄▀ ░█▄▄█' sara3 = '░█▄▄▄█ ░█─░█ ░█─░█ ░█─░█' print (sara1)...
asked by 10.11.2018 / 20:09
2
answers

how to calculate time difference between two clients

How can I calculate the time difference between a client's actions? I want to calculate all the elapsed time of the users until it passes to the next user. example .... from user 1 to two it was 2 days 4 hours, 5 seconds. This is the dataf...
asked by 22.11.2018 / 20:25
1
answer

Align text of items in a QTableWidget

I am trying to center the texts of an item of QTableWidget for which I occupy the following: self.tabla.insertRow(self.tabla.rowCount()) self.tabla.setItem(self.tabla.rowCount()-1,0,QTableWidgetItem(_id).setTextAlignment(QtCore.Qt.Align...
asked by 07.08.2018 / 00:24