Questions tagged as 'python-2.7'

1
answer

Iterate over a list and a dictionary to find mutations in a DNA sequence

I want to find a series of mutations by comparing a couple of sequences. The mutations are defined in two dictionaries and the two sequences have been converted into a list of tuples per position with zip() . I have written the followin...
asked by 01.06.2017 / 13:34
1
answer

Transform dataframe dictionary into a single DataFrame

I have a dictionary that has Pandas dataframes as values. I want to get a new DataFrame joining all the dataframes contained in the dictionary. The problem is that I need to create a new column in which each row has the value of the key o...
asked by 06.07.2017 / 09:50
1
answer

list dictionary elements and a list in a line

Hi, I'm doing a test with lists and dictionaries, I got to a point where I had something like that. datos = {'key1':'a','key2':'b','key3':'c'} dic = ["alfa","beta","gama"] My intention is to print a,alfa b,beta c,gama I tried it with a...
asked by 30.06.2017 / 06:20
3
answers

Use of def __unicode __ (self):

Use Django 1.9. I have two models related to each other, one contains an id and name among other attributes and the other contains its own id along with the id of the first model: class Televisor(models.Model): idTelevisor = models.AutoFie...
asked by 10.02.2016 / 01:44
2
answers

string to list in python

Hello How can I convert string '[1,2,3,4]' to list in python having the following p> valor_inicial = str([1,2,3]) Now I want that initial_value to convert it into a list. How can I do it?     
asked by 05.10.2018 / 21:56
1
answer

Problems importing libraries in Python

I'm doing a tutorial on beautifulsoup in Python (version 2.7) with the following code: from bs4 import BeautifulSoup import urllib2 f = open ('C:\Python27\project\FFootball_DiamondMine\outfileESPN.txt','w') errorFile = open ('C:\Python27\proj...
asked by 16.03.2017 / 01:20
1
answer

Python. Store values in a dictionary

Imagine that in an experiment a participant draws a signal: Senal1_part1 = random.choice("ABCD") Senal1_part2 = random.choice("ABCD") I create a dictionary where I want to store the signals that that participant will observe throughout the...
asked by 13.12.2016 / 00:45
1
answer

I have problems to make a query when comparing dates in different formats

Good afternoon, I would like to know if you could help me with this problem. I have this model where I record the sales made by each user on a default date and that is in datetime now = datetime.datetime.now() db.define_table('registros...
asked by 08.09.2016 / 19:30
1
answer

Migrate from Python2 to Python3.x?

I request support by migrating the version that is currently installed in "Azure" when creating an application in Django in " Kudu Engine ". The following image shows the installed version " Python 2.7.15 ". A thousand thanks     
asked by 28.11.2018 / 21:11
1
answer

Some way to return a list using Python classes

I'm doing a small example with classes in Python but I want you to print a list of elements so use __str__ but I mark the error that it was not a type string here is my code: class intSet(object): def __init__(self):...
asked by 12.07.2017 / 16:40