Questions tagged as 'python'

1
answer

Sorting a list of strings in python

I need to sort a list inside it is another list containing exactly one string and a number, the problem is that I'm not getting the desired result, let's put an example if I have the list below a = [ ['c2sp1s5', 0], ['c2sp1s10', 1],...
asked by 13.12.2017 / 21:47
1
answer

error in path to connection to bank [duplicate]

I'm trying to add this path to the connection to the database, and it gives me this error: File "C:/Users/gabri/PycharmProjects/allbd_s/conc.py", line 4 path='C:\Usuario\gabri\SQLite\conx' ^ SyntaxError: (unicode error) 'unicodee...
asked by 06.09.2018 / 03:05
2
answers

Flask MVC - doubts

I have doubts about making my application as organized as possible, I'm having a hard time implementing MVC ... ThisisthefilethatlaunchestheapplicationfromflaskimportFlaskapp=Flask(__name__,template_folder='template')app.run(debug=True)Thisisth...
asked by 08.09.2018 / 19:17
1
answer

How to get the index comparing two lists of different lengths in Python?

I have two different lists in two CSV files. The first list has 47843 items and the second 813331, which is the first multiplied by 17. I want to get the index position in the first, based on the value of the second, because the second one...
asked by 06.09.2018 / 21:14
2
answers

How to create a PDF from data from a Dictionary extracted from a .txt file (Python)

I have dict() with string data extracted from a arquivo.txt . dic = {} dic[valor[0]] = valor[1] print(dic) >>> dic = {'Almir': 44, 'Ana': 36 ....} I would like to save organized into PDF as follows: nome : 8585 nome...
asked by 16.11.2017 / 21:00
1
answer

Total values in django template

I'm developing a forum that in the index page I need to show the subject, how many topics have this subject and how many posts, I even get back number of topics, but only shows the topic with the subject id 1, for example if you have subject 2 w...
asked by 26.11.2017 / 03:26
1
answer

NoReverseMatch Error in Django

Hello! Studying Django and developing in this Framework, I came across the following error:    NoReverseMatch at / Reverse for 'displayURL' with arguments '(' ',)' not   found . 1 pattern (s) tried: ['profiles / (? P \ d +) $'] For a...
asked by 27.01.2018 / 00:45
1
answer

How to add multiple numbers that were typed into the output?

What I have so far: for c in range(3): n = int(input()) n += n #tenho quase certeza que essa parte não está certa print(n) How to add multiple numbers that were typed in the output ?     
asked by 25.10.2017 / 15:21
1
answer

How to differentiate 2 inputs created with for loop and do operations between them

How do I add the two values entered by the user? My code: for c in range(0, 2): n = int(input('Digite um valor:')) How do I differentiate the first value of the second to do operations such as addition and subtraction between them?    ...
asked by 21.11.2017 / 23:54
2
answers

What is the word "self" in Python? [duplicate]

Excuse my ignorance on the subject because I'm starting now in the Python language, and for that same reason I wanted to know what the reserved word "self" works for. I thank you for your attention and patience!     
asked by 20.10.2017 / 04:48