Questions tagged as 'python'

1
answer

How do I edit a record that already exists in the Django database and does not add another one?

Hi! I've been trying to edit my resgistros in django for some time but instead I add a new one, please someone to help me. This is my editing function: def editarempleado (request, id_empleado): p = Empleados.objects.get(pk=id_empleado)...
asked by 14.09.2016 / 21:07
3
answers

Is it possible to limit the consumption of resources so that the equipment is not left unused?

Sometimes my scripts require a lot of resources and the equipment is left unused. I would like to know how to limit the access of my scripts to the resources of the computer. For example, do not let him use more than 50%. I use the interprete...
asked by 30.01.2018 / 11:22
1
answer

Error saving ForeingKey with Post_save in User profile

I am creating the user profile with post_save signal , but I have a field foreign key that It's not being saved, and I do not see any way to solve it. I did it like this: All this from the django admin.    The error is: 1048, "Column...
asked by 13.10.2016 / 17:22
1
answer

Generate PDF of a post on Django

I have a Blog in wordpress and I'm migrating Django, I have a plugin installed in wordpress that allows you to generate a PDF of a post and I want to pass that functionality to Django. After a lot of searching and several tests, I use djan...
asked by 12.04.2016 / 02:21
1
answer

Read a dictionary from a text file in Python

I am trying to read a dictionary from a text file, this file has a structure like the following: {'foo': 2, 'hola': 'Hello world!'} I have researched and there are recommendations to use the JSON module but I would like to know if there is...
asked by 05.06.2018 / 22:00
1
answer

How to create a relational recommender factor?

I want to create a recommendation system with the factorization_recommender tool that comes from GraphLab. We have user scores on certain hashtags, advertising scores (we call eclipse) on certain togs and even user scores on certain ads....
asked by 08.06.2017 / 18:15
0
answers

Common elements in three pairs of Python fixes [closed]

I have a file with 12 columns, which corresponds to 3 groups of 4 data, such as A1-B1-C1-D1-A2-B2-C2-D2-A3-B3-C3-D3 . I want to search when it is A1[i]=A2[j]=A3[k] and at the same time B1[i]=B2[j]=B3[k] When that happens, I want...
asked by 30.05.2016 / 03:34
3
answers

Iterate different loops for in 1?

I have this code: for k, v in redirections.items(): new_id = list(filter(lambda a: v == a.dialog.peer.channel_id, dialogs))[0].id redirections[k] = new_id for a, b in redirections2.items(): new_id2 = list(filter(lambda a: b == a.d...
asked by 20.12.2018 / 17:46
1
answer

"SimpleHTTPServer" in Python 3

In Python 3, what would be the equivalent of python -m SimpleHTTPServer ?     
asked by 17.06.2016 / 12:06
3
answers

Problem with pyttsx

I am trying to work with the pyttsx module. I read the documentation and followed everything to the letter. However, when I try to run a script as simple as this: import pyttsx engine = pyttsx.init() engine.say('Sally sells seashells by the se...
asked by 20.07.2017 / 22:57