Questions tagged as 'python'

1
answer

How to separate a list with a delimiter?

How can I do this exercise? "Write a program that given a text file, a delimiter, and a list of fields, print only these fields, separated by this delimiter. " At the moment I have this: f=open("archivo.txt","r") delimitador=str("-") list...
asked by 09.02.2018 / 19:53
1
answer

Example that triggers the error: "Invalid Syntax"

I am beginning to learn to program in Python through a book. They gave me this example but when I try to run the program I get "Invalid Syntax". >>> userInput= input("Enter 1 or 2:") Enter 1 or 2: if userInput == "1": prin...
asked by 28.01.2018 / 11:05
2
answers

How to read a CSV file in Python and extract the maximum and minimum value per minute?

I used this code to extract the data from a CSV file, filter it and even organize it per minute, but I would like your help to create a cycle that allows me to update the information per minute, determining the maximum and the minimum value. i...
asked by 29.01.2018 / 06:17
2
answers

Given the hash () of Python, does it exist similar in PHP?

I have a python script, which performs a login and pass, which is stored with hash in Mysql, with the following code: pass = hash(self.get_argument("psw", 'dato')) generating a hash type -5995266028892256335 Now I need to login from PH...
asked by 26.01.2018 / 13:54
2
answers

Hello I want to delete certain content from a folder

I have a simple doubt. I have generated some files in different formats (.csv, .txt, etc) I need to delete some. Specifically all ".csv" and those that end with "h + *. Txt" (with * any integer from 1 to 99). I've tried this: for arc...
asked by 26.01.2018 / 13:54
1
answer

Add item to list in Python

I want to make a program in Python in which pressing 1, print a list of colors and pressing 2, give me the option to add a new color and pressing again 1, I see the list of colors with the new addition , What should I do? This is what I have:...
asked by 04.02.2018 / 16:41
2
answers

postgresql error with django

error: manage.py makemigrations Traceback (most recent call last): File "C:\Users\pcort\Documents\Programacion\programacionWeb\postgresql_django\venv\lib\site-packages\django\db\backends\base\base.py", line 216, in ensure_connection self....
asked by 11.01.2018 / 22:36
1
answer

Error 'NoneType' object is not callable when trying to select item by id

I'm trying to get to an element of the DOM that has a certain id . The problem is that I am using the .getElementsById() method of AdvancedHTMLParser , which is available in your guide . Once I extract the HTML from the URL ,...
asked by 27.12.2017 / 19:47
1
answer

Doubt about dictionaries in Python

What is the purpose of p in the dictionary? p = Clase() for c in diccionario.keys(): if variable == c: diccionario[c](p)     
asked by 27.12.2017 / 22:28
3
answers

Multiple excel operations with Python

I have an excel file where I keep information, more than 10,000 data. I need to be able to realize 1 massive account that is a division between two cells. The problem I have is that I do it but not for all the data. To this I mean that I have al...
asked by 15.01.2018 / 13:27