Posts by Rocchi • 143 points
14 posts
-
1
votes3
answers394
viewsA: Leave each word in a row (Text file) - Python
A line break in text is nothing more than a special character " n". In python, there is the 'replace' method for strings, which is used like this "blabla".replace('a' , 'e') resulting in the string…
-
0
votes1
answer115
viewsA: Problem using if and Elif Python
It seems to me that you are changing the variable 'counter' before using it entirely. See that inside the loop, after the second 'if' you change 'counter'. In the next line you use…
-
0
votes2
answers59
viewsA: Beginner - Unexpected Behavior in a Variable
In your code, you are calculating MEDIARESTANTE using the fixed value of VRACTUAL and the variable value of x. That is, you are dividing the same starting value for fewer and fewer days. VRTOTAL =…
-
1
votes3
answers7344
views -
0
votes1
answer82
viewsA: How do I write a tabular file in an instance of Azure Data Lake Store with the Python API?
I don’t use Azure, so forgive me if it’s not relevant: I’ll reply how to write data to a CSV file using Python3.x. It is worth mentioning before that most libraries include a method to convert to…
-
2
votes1
answer376
viewsA: Block comments on bash script
Missing space between first line characters in the following option: : ' Comentarios aqui.. '
-
0
votes1
answer38
viewsA: Work with two cursors on the same connection
You can fix this without infinitive + gerund. Simply assign each query to a variable using fetchAll() and then compare the variables.
python-3.xanswered Rocchi 143 -
0
votes1
answer180
viewsA: Problem when inserting rounds in stone game , paper and scissors
The 'round' variable is being declared twice without being used at the beginning of the program. First 'round = 0' then 'round = 1' without anything happening. The functionality of the variable…
-
0
votes1
answer2703
viewsA: Comparing variables in Python
A python list can contain an item twice, a set (set) no. Then you can put the votes in a set and check if the list size decreases. len([1,1,2,3]) >>> 4 len(set([1,1,2,3])) >>>3 The…
python-3.xanswered Rocchi 143 -
1
votes1
answer865
viewsA: Requests, Beautifulsoup <Tables>
The code on this site is a mess. What’s happening in your code, is that you’re searching column by column on every row of the table. You may notice that if you read different items from the list…
-
0
votes2
answers1005
viewsA: When finishing the script with "Ctrl+C" (Keyboardinterrupt) does not close Selenium Firefox
You can kill firefox regardless of Selenium, with the consequence that you kill the entire process, not just the tab your script has started. In addition to not closing the process in a "clean way".…
-
0
votes1
answer46
viewsA: String inside a model in python?
If the user has little freedom of entry, you can get rid of "a" and test whether the rest of the string converts to number. texto = "a123" outro = texto.replace("a","") #substitui 'a' por nada if…
-
0
votes2
answers356
viewsA: Counter in a dictionary value
You need to access the current dictionary value for the value of numero_camisaand increase that value by 1. Before you see the answer, try to do it yourself this way. As you open the current value…
-
1
votes1
answer1245
viewsA: Copy entire directory with python
You can use the library shutil Note that it has a warning about the inability to copy metadata, you may encounter other problems according to your OS. The best solution would be to write the Bash…