Questions tagged as 'python-2.7'

2
answers

Can you return a print or a message in python?

If in a function I can return a print or the message itself that they ask me to give, the exercise says that if the number is inside the list it must tell the user that such a value is in the list and the same in case opposite. def comprobarEn...
asked by 20.10.2018 / 23:35
1
answer

Trying to recreate the ls -l command in Python

I have been creating a bash simulator in windows using python for some time, at this moment I am programming the command: ls -l The problem is that I do not know how to make the following data in the file or folder print: permissions...
asked by 30.04.2018 / 03:02
1
answer

How do I import packages from a subfolder to a folder? In python

Suppose that each folder / package already has its respective init .py If I have this composition: -Carpeta Padre | archivo1.py | | Carpeta Hija | | |archivo2.py | |_____________ | |____________________ I would li...
asked by 15.03.2018 / 20:11
3
answers

Avoid reading .py files

In the company we are developing a project with python using a raspberry. The program is already done and it is intended to market the service that makes the code so we require that you can not read or edit the file. It starts automatically thro...
asked by 14.03.2018 / 21:59
2
answers

Remove items from lists in the dictionary

I have the following code which is a dictionary with lists inside. What I want to do is erase a certain element from all the lists. For example: delete everything in position 2 of each list (bike, 2 and C). dicc={} dicc['lista1']=['coche',...
asked by 02.02.2018 / 10:42
2
answers

Problem with a Choice [Django - Pyhon]

Good morning! I have a modeo which has a field of type text in which is a "choice". ANUNCIADA = 'A' AMARRADA = 'M' TERMINADA = 'T' ANULADA = 'N' LIST_ESTADOS_ANUNCIOS = ( (ANUNCIADA, 'Anunciada'), (AMARRADA, 'Amarrada'), (TERMINADA, 'Termi...
asked by 02.02.2018 / 18:52
1
answer

pycurl error. TypeError: invalid arguments to setopt

I made this code with the pycurl library import io import pycurl from StringIO import StringIO c = pycurl.Curl() c.setopt(pycurl.URL, "http://www.twitter.com/") c.setopt(pycurl.HTTPHEADER, ["Accept:"]) c.setopt(pycurl.COOKIEFILE, "cookieD...
asked by 28.12.2017 / 12:18
1
answer

To extract information from a table?

I need to extract the information from a table with selenium, python. Cuepo html: <table class="table table-bordered"> <tbody> <tr> <td>Valor de...
asked by 28.12.2017 / 23:21
2
answers

Sort CSV Python values

I have the following code that creates a CSV with data obtained from another CSV. In this image I die my results: Now, what I'm looking for is that the new csv instead of recording with all the data, first I ordered the data from highest t...
asked by 11.12.2017 / 13:07
1
answer

Redirect immediately with SELENIUM PYTHON

I make a login and login but redirect me to a page which has errors and remains loading. The credentials are kept even if the page does not load completely. The page has a loop that keeps reloading the site. After the start of the session,...
asked by 27.11.2017 / 15:49