Questions tagged as 'python-2.7'

2
answers

Comparison List of lists and list python

I am looking to make a comparison of a list with a list of lists. With this code I can do it between 2 lists but the problem happens when it is a list with a list of lists. I am looking to edit my code to be corrected. lista1=["paco","pepe"...
asked by 11.12.2017 / 20:29
2
answers

XLSX Python Search

With this code I can convert a certain column of an xlsx into a list. I need a function that looks in the directory where I am if there is any file with the values that are in my list called to: >>> [u'Jose', u'Martin', u'Pedro'] prin...
asked by 21.12.2017 / 01:57
1
answer

Help to get summation list of lists generated iteratively

I have developed a program with which I generate a list in each round of a total of 5 rounds. I add these lists to a list of lists called my_list_tot. The code is as follows: import random mi_lista_tot=[] for round in range(5): mi_lista=...
asked by 02.10.2017 / 20:35
2
answers

Unify 2 functions to read files with python

Since some time ago I am trying to make a bash simulator using python, I am creating the tail and head commands, for this create 2 functions: def head(textfile): content = [] try: file = open(textfile, "r") for line in...
asked by 28.05.2018 / 19:09
2
answers

Stop Python script on NAO robot when touching the head

My problem is as follows. I have a Python script that runs so that the NAO robot performs various non-stop actions until the execution stops, however for security reasons (in case the robot goes crazy and wants to kill us all ) I need to add so...
asked by 31.08.2017 / 20:03
1
answer

How to save an image of any format in Python?

I have been investigating the way to save an image in python but so far I have not found anything that can be useful, what I need is to know that import have and how to save the image in python, this image will keep it in a database in mo...
asked by 07.08.2017 / 17:17
1
answer

How to use global variables in python

I'm trying to keep the value read in a webhook in the following webhook but the variable that takes the value does not keep it in the next webhook. from flask import Flask from flask import request import os from threading import Thread app =...
asked by 12.06.2017 / 16:43
1
answer

How can I read or print a block of lines or data from a file, between two lines or two keywords within the file in python?

I have several files with the same format and I want to read a block of those files from the line where the numbers or data of the time, voltage and current appear, until the line 'final data', this would be an example or something similar to th...
asked by 20.04.2016 / 15:48
1
answer

unsupported operand type (s) for +: 'NoneType' and 'NoneType'

I am trying to save elements that I parsed from a csv file in the database and at the time of splitting those elements I get an error unsupported operand type (s) for +: 'NoneType' and 'NoneType'and I do not know what do. def Procesar(request,...
asked by 25.04.2016 / 18:01
2
answers

Pyramid of numbers in python

I must make a pyramid that something like this  n = 5 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 but what I try to do gives me that way number n: 6 0 1 2 3 4 5 0 1 2 3 4 5 1 2 3 4 5 2 3 4 5 3 4 5 4 5 5 6 this is the code nu...
asked by 16.10.2018 / 03:15