Questions tagged as 'python'

1
answer

How to make crontab run a script in Python

I'm trying to schedule a script I wrote in Python to run in crontab , but I'm not able to do it. The script is simple thing, it makes a telnet connection through the terminal and sends some commands. I was able to schedule a shellscript , howe...
asked by 09.03.2018 / 02:46
1
answer

Field handling in the Model before writing to the database (Python + Django)

I am trying to perform a password encryption using Python 3.7 and Django 2.1. Looking at the Python documentation, Django and some answers here in StackOverflow, I came up with the code as follows, however, the password field is written blank...
asked by 31.08.2018 / 13:46
1
answer

Submit POST form with python

I'm developing an API in my work, and I need to develop something in python2 that sends a form to the server through POST, I saw some questions here in the forum and I could not find anything that worked ... I need the community to help me !...
asked by 16.12.2017 / 01:49
1
answer

Python, Django with multiple databases

To work with several databases in the Laravel framework, once you have configured all the connections in the configuration files, simply define in the model which connection to the database that model will use, and then regardless of the operati...
asked by 17.12.2017 / 22:25
1
answer

Return the largest number in Python with recursion

My teacher started talking about recursion, and spent some exercises, only that I caught on one. As I said in the statement below, I should create a function that returns the largest value contained in a list. My problem is: I can not do t...
asked by 19.06.2018 / 19:58
1
answer

Processes in Python

I am studying the multiprocessing module and in all the examples in the Python documentation There is always a% checking in the examples, I know this checks to see if the file is being executed directly or being imported but has some...
asked by 08.08.2018 / 19:49
1
answer

How to pass keywords arguments in python in a simpler way?

I'm trying to create the button class and trying to get the arguments that I can pass pro rect, so if any argument is None and I pass for example self.rect = pygame.Rect(x=x) and x is None of the error, then I'm doing so: if x:...
asked by 01.12.2017 / 15:57
1
answer

Write file in JSON

I have a series of files in JSON format, so work better organize all of them into a single file using the following method: import json filename = "dados_geral.json" for mensagens in range(1,6): arq='data_gephi_%d.json' % (mensagens)...
asked by 12.12.2017 / 14:26
2
answers

How to pass arguments by reference in Python?

When I studied Pascal I remember that my teacher explained that to pass an argument by reference it was necessary to put var in front of the variable in the function / procedure parameters. Example: function exemplo(var, a: real):rea...
asked by 14.11.2017 / 19:54
3
answers

Do import another detrous module from another using LibreOffice macros

This question refers to the use of python macros in LibreOffice. I've been doing some research on the subject and found that one of the ways to add a macro written in Python to LibreOffice would be to put it in the directory: ~/.config/libreo...
asked by 22.11.2017 / 12:35