Questions tagged as 'python'

1
answer

Filter words in python

I would like to filter in a program that I have made that hunts specific messages from a database. I've been watching other posts and googling a bit, and if I duplicate any existing questions, I apologize, but I can not find exactly what I'm...
asked by 12.12.2018 / 16:50
2
answers

Is it possible to declare a variable that contains an if statement?

Is it possible to declare a variable that contains an if statement? The following pseudocode (written only with the idea of illustrating the example), represents the idea that is pursued, that is, that the variable m take a different value depen...
asked by 15.08.2017 / 17:57
1
answer

Problems with Image Link

I created a model called worker that has a field called signature where I'm uploading the signature digital in an image: class Trabajador(models.Model): usuario = models.OneToOneField(User) dni = models.CharField(max_length=8,p...
asked by 10.05.2016 / 17:29
2
answers

Python operation

As I understand it, when creating a variable, we are creating an object, and the name of the variable refers to it. If I do: a = 2 a = "Hola" The garbage collector is responsible for deleting object 2, since it does not need it and no ot...
asked by 20.02.2017 / 13:23
4
answers

Python. Extract random object from a list

The problem is that I have a list "l" of which I want to select a random item several times without repeating it, and I do not know how to do it. Any suggestions? import random l = ["a", "b", "c", "d"] sel1 = random.choice(l) That'...
asked by 20.06.2016 / 01:54
2
answers

Problem when defining time zone using tzinfo on datetime using pytz.timezone ()

I found the following problem when creating an object of type datetime with the constructor parameter tzinfo that defines the time zone. To define a time zone I used the pytz module as follows: import pytz as tz import dat...
asked by 09.08.2017 / 23:02
2
answers

Read files with python, problem getting value with .readline ()

I have a problem when I want to execute as parameters or variables the data I extract from a txt file. For example: conexion = kinterbasdb.connect(dsn=str(dir),user=str(user), password=str(password)) global variable1 variable1 = 'C:/carpeta/...
asked by 31.03.2016 / 00:46
3
answers

Boolean operators Python

Hello my question is a very simple question, I have these two expressions and let me analyze them to see if I do it correctly: False or not (True and True) False In this first expression following the recommended order, I first analyze not...
asked by 01.10.2016 / 17:19
3
answers

Create global variables

I am quite new to the Python syntax in particular such as creating global, nonlocal and local variables and how to declare them without syntax errors . For example in the next program, I have # Estamos creando el juego de Piedra, papel o t...
asked by 23.05.2016 / 21:37
2
answers

Generate EXE for Windows different Architectures

How to compile a Python desktop application for Windows with PyInstaller? The problem is the difference of architectures, I'm using PyInstaller to generate an EXE from the x64 architecture when executing it in x86 it tells me that there is an...
asked by 30.03.2016 / 21:03