Questions tagged as 'python'

1
answer

What is the function of the -m Python option?

To find out which version of Django I have installed, use the following command in the terminal: python -m django --version What is the function of the -m option of this command?     
asked by 25.05.2017 / 01:15
1
answer

References are not available in the final program

I'm validating some functions created in python, I have a code that creates some functions. When I run the program with the functions (test_client.py), I get run-time error. auth_utils.py: from hashlib import sha256 try: from urllib import...
asked by 19.02.2017 / 03:49
1
answer

How to keep a fixed value inside a recursive function?

I'd like to create a variable with the first value passed as a parameter in a function, but every time a recursive call is made the variable receives the value of the new passed parameter. For example: def fatorial(n) print(n) if n <...
asked by 28.05.2017 / 20:21
1
answer

Problem with accentuation when executing python script straight from C #

I'm using this to run the code: processo.StartInfo = new System.Diagnostics.ProcessStartInfo { FileName = @"\Python27\python.exe", Arguments = arquivoResposta, UseShellExecute = false, CreateNoWindow = true, WindowStyle = S...
asked by 24.12.2016 / 18:41
1
answer

Why can not tkinter execute a 'simple command'?

I would like to understand why in the code below the tikinter (I think that's the problem) can not do something simple like     'c = c + 1' ? Code: from tkinter import * import pygame.mixer sounds = pygame.mixer sounds.init() c = 0 e...
asked by 08.03.2017 / 05:02
1
answer

Django, retrieve selected value on page

Good evening! I created a view where I retrieve the sellers and created a variable (sales_id) to receive the selected salesperson on the screen. The html is being created correctly, but the variable in the view does not receive value in POST:...
asked by 09.03.2017 / 03:47
2
answers

use variable in cmd command with python

I wanted to make a program that opens and reads a text file. Then run or command in cmd using what he had read in the text file something like this: import os nome = open ('nome.txt') nome1 =nome.readline() nome.close() comando...
asked by 12.02.2017 / 23:02
3
answers

Recover array dimensions in Python

Can one help me write the "dimension (matrix)" function that receives an array as a parameter and prints the dimensions of the received array in iXj format? def crie_matriz(n_linhas, n_colunas, valor): matriz = [] for i in range(n_li...
asked by 05.02.2017 / 17:56
1
answer

Error in the language of the month Django

Good morning guys, Next, I have a very uncomfortable problem. When I try to use the date that was stored in the database, it comes with the month in English. settings.py: LANGUAGE_CODE = 'pt-br' TIME_ZONE = 'America/Sao_Paulo' USE_I18N...
asked by 05.02.2017 / 12:20
2
answers

Print multi-dimensional array in Python

I'm in doubt about how to create a function ( imprime_matriz ) that receives an array as a parameter and prints the array row by row. Note: Spaces after the last element of each line should not be printed. Can anyone help me? The code...
asked by 05.02.2017 / 17:03