Questions tagged as 'python'

1
answer

What problem can occur when retriggering a value without having a variable to receive (Python)?

If I have a function that returns a value or True and False, but does not have a variable to receive, can this cause some problem in the code operation? Example: def Retorna(): return False def Retorna2(): return 100 Retorna() Ret...
asked by 22.01.2018 / 13:26
1
answer

How to modify a list inside a method in Python?

Suppose I have the following method and the following list: def ModificaValores(Valores): dados = [6,5,4,3,2,1,0] Valores = dados Valores = [0,1,2,3,4,5,6] print(Valores) ModificaValores(Valores) print(Valores) Why in the out...
asked by 22.01.2018 / 12:22
2
answers

filter list in a Django admin foreign key field

I have two questions, both related to the form automatically generated by django admin. If I create an administrative screen I can solve these problems, but working directly with the admin I am suffering a bit, even because I believe that the ad...
asked by 23.01.2018 / 18:01
1
answer

Application for login to another site (Facebook), error "InvalidSubmitError"

My code is this: import robobrowser import re url = 'https://m.facebook.com' loggedin_title = 'Facebook' # isto vai servir para confirmarmos que estamos loggedin, vendo o titulo da pagina para onde fomos redirecionados browser = robobrowser...
asked by 16.01.2018 / 12:25
1
answer

How to use JSON in Python?

I am using the following code to collect the Urbandictionary site API import requests import json page = requests.get("http://api.urbandictionary.com/v0/define?term=hello") print(page.content) Soon after execution, I get the following resu...
asked by 08.01.2018 / 22:35
1
answer

Meaning of% in strings!

Hello, I was following a video lesson in Python string formatting and I saw that the teacher used% d and%, but my internet is having problems loading the video, I wanted to know what that means%     
asked by 17.01.2018 / 21:00
1
answer

Calculation exercise largest number python

Good afternoon, I'm developing an exercise in python , I saw that there are already some similar resolutions in the forum, but I have developed one myself and I do not understand the reason for the malfunction (only 0 is returned, be that it...
asked by 09.01.2018 / 21:22
1
answer

Django + AJAX - POST 404 (Not Found)

I'm trying to implement a system of likes in a Django + AJAX application, but when trying to do the operation in question I'm getting the following error in the browser console: POST http://localhost:8000/forum/like/ 404 (Not Found) . I do...
asked by 10.01.2018 / 15:07
1
answer

How to manipulate docx files using python?

I created two docx files but I can not write to them (using python) however I can do this with txt files. The question is could I create a docx file and write to it using a python script?     
asked by 05.02.2018 / 00:41
1
answer

How to make a frequency distribution table in Python? [closed]

Good afternoon, One question: Could anyone clarify me how I can make a frequency distribution table: classes; absolute and relative frequency; cumulatively; average values of each class.     
asked by 19.01.2018 / 20:31