Posts by Rfroes87 • 465 points
15 posts
-
1
votes1
answer16
viewsA: Use of _set in Django framework
The pattern <modelo>_set or default_related_name is essentially responsible for making the reverse relationship of one (its object q instantiated from the class Question) for many (0 or more…
-
1
votes1
answer58
viewsA: What is the difference between utils::Urlencode() output in R and urllib.parse.quote() in Python
These characters , and : of your example are reserved characters that, according to the own Rdocumentation are preserved. Highlighting the relevant section: In addition, ! $ & ' ( ) * + , = : /…
-
6
votes2
answers187
viewsA: How does regular expression with double range work?
When the list is introduced by ^, she becomes a denied list. For your example, you are simply modifying the scope of a list A-Z filtering the characters that are included in crease A-R and U-Z. Note…
-
2
votes2
answers141
viewsA: How to group substrings in condition and return them with BASH_REMATCH
As an alternative to the solution provided by the user @Marcelovismari, here is a regular expression compatible with bash 4.2+: str="python-zope-proxy-4.3.5-1-x86_64.chi.zst" if [[ $str =~…
-
1
votes1
answer174
viewsA: Query in array with mongodb
If I have understood correctly, you need to find 1 or more documents containing the expression FARIAS, C. M. inside the array NOME-EM-CITACOES-BIBLIOGRAFICAS. To have access to it with the operator…
-
2
votes1
answer101
viewsA: Rename folders by changing lowercase characters to uppercase and get the total number of folders changed
I believe the function walk would be more appropriate for your use case. You could use it this way: import os # Inicializando estatísticas num_files, num_dir, num_transform = [0] * 3 """ Aqui cada…
-
2
votes2
answers110
viewsA: Compare files in folder and delete specific ones in Python
It was not clear what should happen in this case: 01 - Carlos 01 - TSE 02 - TSE 02 - Mary 03 - Mary 03 - Carlos As can be seen above, there are multiple references of the same name in different…
python-3.xanswered Rfroes87 465 -
2
votes2
answers69
viewsA: I can’t debug imported module in project in Visual Studio Community 2019
I found the option "Enable debugging of the Python standard library" within "Tools > Options > Python > Debugging" and together with "Enable Just My Code" in "Tools > Options >…
-
2
votes2
answers69
viewsQ: I can’t debug imported module in project in Visual Studio Community 2019
I’m using version 16.7.5 of Visual Studio Community 2019 where I’m implementing for the first time a pyproj (Python version 3.8.3) in a virtual environment env. I installed the library…
-
0
votes1
answer44
viewsQ: Count based on the value of a field and index filter in Elasticsearch with Elasticsearch-dsl
I’m using Python3.6, with elasticsearch (7.9.1) and elasticsearch-dsl (7.3.0). On my index logstash-2020.09.21 i have some documents as below (filtered by the relevant fields): { "subtype":…
-
1
votes4
answers65
viewsA: I cannot print a list(vector)
Try to change this line: aux = len(cont) For this: aux = len(cont) - 1
-
-1
votes2
answers157
viewsA: How to optimize this code?
I don’t know very well the logic behind it, but follow my review. I believe it is more efficient, when possible give a check, please: while True: n = int(input()) if n == 0: break loop =…
-
0
votes2
answers66
viewsA: Problems with import and from/import command
You’re not importing the module math, but only the function sqrt directly. To solve this you just need to change the line import of this: from math import sqrt For this: import math Now, if you want…
-
2
votes2
answers240
viewsA: Vector union in Python
To make the union, you can modify the function by adding the lists a and b and turning them into a set (who is responsible for removing duplicate values). Would look like this: def union(x, y): aux3…
-
1
votes1
answer23
viewsA: Django: imported class is not being called
In the loop statement you are assigning to the class itself Album instead of the variable album. Replace this line: for Album in all_albums: For this reason: for album in all_albums:…