Questions tagged as 'python-2.7'

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 / 15:57
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 30.03.2016 / 22:46
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 / 19:03
2
answers

Working with python lists

I have the following list lista=[('1', '3', 0.29), ('1', '2', 0.36), ('1', '5', 0.32), ('1', '7', 0.19), ('0', '2', 0.26), ('0', '4', 0.38), ('0', '7', 0.16), ('0', '6', 0.58), ('3', '2', 0.17), ('3', '6', 0.52), ('2', '7'...
asked by 17.06.2017 / 23:50
1
answer

Transfer files from sub-folder to main folder in python

I have enough folders that in turn have their respective sub-folders, inside one of those sub-folders there is a subfolder_1_2, subfolder_2_2, subfolder_3_2 that contains files for example: carpeta │── Subcarpeta_Principal1 │...
asked by 19.01.2016 / 20:44
1
answer

How to cut chain and join it in a variable

esta1seg0831a.txt my file that I want to cut file_name = esta1seg0831a.txt year = 2016 month = file_name[8:10] day = file_name[10:12] estacion = file_name[:4] nombre = file_name folder = [year,month,day,estacion] My output result is =...
asked by 06.09.2016 / 22:01
2
answers

Icon for windows with TopLevel

Within a kind of application of the style of a Text Editor, I open the typical "Help" and "About" windows. Both windows are made using the Toplevel Tkinter widget. And I would like to put an icon that appeared in the taskbar as I have done fo...
asked by 20.05.2018 / 22:32
1
answer

InsecurePlatformWarning when using pip on Ubuntu

I am observing an alert message (not an error) InsecurePlatformWarning when executing the pip command in Linux: $ pip search reportlab /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90:...
asked by 02.12.2015 / 14:39
2
answers

Browse folders in python

I have the following code: import os, glob from obspy.core import read for fname in glob.glob('BC.*'): arch=fname.split('.') print "<==== ", fname # Quita la extension (.msd), si existe if(len(arch) > 7): del arc...
asked by 16.02.2016 / 17:55
1
answer

Error entering data with input ()

This is my code, which I run in Python 2.7.13: print "hola" hiola = input() if hiola == salsa: print "hola" And the error that throws me is the following: Traceback (most recent call last): File "C:\Programacion\Python\hola.py", li...
asked by 17.05.2017 / 19:03