Questions tagged as 'python'

2
answers

Access related table columns via ORAN DJANGO

How to access the object user and its attributes after a join ? This is my query Idea.objects.select_related("user").values("author_id").annotate( qtd=Count('author_id')) Example of a result: <QuerySet [{'author...
asked by 22.11.2018 / 15:29
1
answer

Imports within functions in Python

I've seen cases where the developer does the import of a module within a function, some cases mainly in the documentation of Django, why it was not very clear to me, if anyone can help me thank you.     
asked by 11.07.2018 / 01:43
1
answer

Determining sequence of numbers with bubble sort from a txt file in python?

I have an input file in txt with data type the following: 7 6 8 4 8 5 0 1 2 1 0 3 2 3 0 This file is about 3 students from a school. The first line is the age of these 3 students (the first column could be student1, the second...
asked by 17.07.2018 / 22:53
2
answers

Method split and rsplit, python

I made this little program to try to simulate the methods 'split' and 'rsplit' of Python , but when I run it it does not print the last sentence of the string. For example, if in the string I type 'pao ou açucar ou café'...
asked by 15.09.2018 / 18:39
2
answers

Remove blank lines in a csv

I'm trying to remove empty rows from a csv document: Document:    sentence, lingua      ., pt      ., in      ., in      ., it      ., en      ., pt      ., pt      ., en      ., pt      ., pt       "it's not expensive", in   ...
asked by 25.06.2018 / 11:52
1
answer

Problems with __eq__, __lt__, etc. and the method removes the object list

I'm having the following problem, I have a class letter and I use the magic methods eq , ne , le , lt , gt to be able to compare the value of two cards and also to be able to use the sort function, and this works the way I expected but whe...
asked by 29.06.2018 / 15:22
1
answer

How do I extract the names of several folders within a directory?

I need to enter into a folder called / users , where inside it to several folder and copy the name of all folders, follow the example. I wanted to be able to get the name of these folders and save them to a list in python.     
asked by 17.05.2018 / 19:49
1
answer

Pandas: comparing information in DataFrame

I have 2 DataFrames imported from CSV CSV1 4616; CCIVIL_03/decreto/2003/D4616.htm 4617; CCIVIL_03/decreto/2003/D4617.htm 4618; CCIVIL_03/decreto/2003/D4618.htm 4619; CCIVIL_03/decreto/2003/D4619.htm 4620; CCIVIL_03/decreto/2003/D4620.htm 46...
asked by 06.06.2018 / 19:15
1
answer

Difficulty removing child, Python

Good morning, friends. I'm having trouble removing a child. I wrote a code to collect all the prices of the products of a website (it is a list of products, not a page for each one). On this with no problems, the code works well. It turns out th...
asked by 07.11.2018 / 12:41
3
answers

Difficulty with first code

This is my first code that does not involve my course classes. My goal is to put together a code that asks that any chemical symbol be inserted and this will tell your group. Very simple concept, but I'm having difficulties in it. elemento = s...
asked by 13.11.2018 / 23:22