Questions tagged as 'python'

2
answers

Open file from another location by relative path

I need to open a file that is in another directory that is being worked on, I tried with: open("../carpeta/subcarpeta1/subcarpeta2/archivo.log") but when I run the script I get:    FileNotFoundError: [Errno 2] No such file or directory:...
asked by 30.01.2018 / 05:27
2
answers

execute javascript in python

When accessing a web via python, is there a way to show the response code of a javascript? what the user sees I have this: import mechanicalsoup browser = mechanicalsoup.StatefulBrowser() print(browser.open("https://www.web.com/")) print(br...
asked by 31.01.2018 / 23:07
1
answer

Problem with the use of python classes

When I run my program it gives me this error:    new = colony.Colonia (self .__ tasks, self .__ times)   UnboundLocalError: local variable 'colony' referenced before assignment my class is the following: import tareas import hormiga imp...
asked by 30.01.2018 / 20:35
1
answer

Check that the data of a CSV file changes and print the error - Python

I have to make a file in Python that controls a file ". csv" , and if any parameter changes, indicate what value has changed, and if it matches the expected output. ELEMENTO1,1,1,0,-1,0,-1 When you change a column, it would be: ELEMENTO1...
asked by 13.11.2016 / 12:58
1
answer

print () does not show the message

I have made a game of guess the word, and I have a piece of code that verifies if the user has already entered a letter before, it looks like this: if letra in actual: clear() print('La letra ya se encuentra en la palabra')...
asked by 05.07.2017 / 22:04
1
answer

Problem with regexp when using. * "

I am using the re module to extract data from a web. Specifically: link But I have a problem, if I do: re.findall('<a href="(.*)"', data) It returns me from the beginning of the href to the end of data. If I do: re.findall('<a...
asked by 08.07.2017 / 08:31
1
answer

Read string of several lines entered in PYTHON console?

I use Python 3.6 and I try to read an entry data of several lines to store it in a variable and then manage each line in a list for example. The structure of the code is something simple like this: print("Escriba la lista de ciudades de la...
asked by 30.03.2017 / 22:24
1
answer

How do logic work in SFrame in Python?

I'm new with python but I know R. I want to obtain certain houses with Python thanks to logical conditions that are houses with more than 2000 square meters but less than 4000 square meters. I use this website to understand how to use the logi...
asked by 04.04.2017 / 14:17
1
answer

How to call data in csv of date and time that are in the same column, to make a daytime cycle?

I am very new to this! I'm looking at a class called data analysis, where we are asked to perform a diurnal cycle of a time series that measures radiation per minute, but I have a file in csv where in a single column I have the date and time, as...
asked by 25.11.2016 / 18:27
1
answer

Error in PIL, image index out of range, python

Very good, I would like you to clarify a doubt. Creating a function that from a "L" image creates a matrix with the values of its pixels, it returns this:    return self.im.getpixel (xy), IndexError: image index out of range If someone ca...
asked by 21.09.2016 / 22:44