Questions tagged as 'python'

2
answers

Start a command line tool in Python

How can I create a command line tool in Python that works like ls of Linux or dir of Windows? How would I start a script like the one that will later be compiled as an executable?     
asked by 01.08.2016 / 21:55
5
answers

How do I find the position of an item in a list?

I am writing a program that receives a specific amount of values, and returns the lowest value in the list and its position. It is as follows: quantidade = int(raw_input()) numeros = raw_input() NumerosNaLista = numeros.split() if len(NumerosN...
asked by 10.04.2016 / 00:18
2
answers

Python dot notation (methods)

How do you create methods of type dot notation, those that are called object.show () instead of show ( objec ) , or do they apply only to strings, if so why exactly?     
asked by 15.06.2017 / 01:08
4
answers

How to know which version in use of a particular package installed via pip?

I'm starting to program in python and I've been trying to use best practices: virtualenv, pip, etc. One of the packages I have used (pelican) has different help pages for each version. How do I know which version I am using? I installed it with...
asked by 14.06.2015 / 17:21
2
answers

List Comprehension for this case

How can I use list comprehension for this case: >>> a = 'A' >>> lista = [1, 2, 8, 5, 10] >>> l = [a, num for num in lista if num%2 == 0] File "<stdin>", line 1 l = [a, num for num in lista if num%2 == 0...
asked by 15.09.2016 / 16:56
1
answer

Exercise of python

In codeacademy, I'm having the error with the following code: # Tenha certeza que the_flying_circus() retorna True def the_flying_circus(): if 5==5 : # Comece seu codigo aqui! return True # Nao esqueca de recuar # o...
asked by 07.08.2015 / 07:24
2
answers

Programming with client and server: How to get numerous data exchanges per client and numerous clients simultaneously?

The client: from socket import * serverHost = 'localhost' serverPort = 50007 # Menssagem a ser mandada codificada em bytes menssagem = [b'Ola mundo da internet!'] # Criamos o socket e o conectamos ao servidor sockobj = socket(AF_INET, SOCK...
asked by 08.04.2018 / 00:54
2
answers

Returning ZIP code data in form

I have the following problem: I am trying to fill in the fields public place, city and state with the informed zip. They are all input. I'm using link My project is in Django, but I think you can return the data directly on the html page (fron...
asked by 21.07.2014 / 04:41
2
answers

Regexp extract value

I have the following strings:    "The.Office.US.S {SE} AND {EP} .The.Dundies.720p.srt"       "The Office [{SE}. {EP}] The Fight.srt" This string is a template of the name of a file, the files will be in the following form    "The.Offi...
asked by 12.06.2017 / 01:29
5
answers

How to find out the type of a variable given by the user?

I would like to ask the user to type something and find out what type of what he wrote. So far I only know input() , but input() only returns String type. If I by int(input()) or float(input()) fall into the sam...
asked by 15.12.2017 / 03:08