Questions tagged as 'python'

2
answers

Is it possible for me to create a runtime class in Python?

I wanted to create a class at runtime to do updates to databases, for example, but without being dependent on DBMS, instead using python and wondering if it's possible to create these classes at runtime.     
asked by 29.06.2017 / 05:24
1
answer

Run command in python with selenium called by php through apache

I want to run the following script in Python through a web site on the server: #!/Python34/python from selenium import webdriver driver=webdriver.Firefox() driver.get("C:\wamp64\www\desenvol\index.html") elem1 = driver.find_element_by_link_te...
asked by 29.05.2016 / 22:22
2
answers

How do I know if a list is empty in Python?

I'm starting in python and always end up with some doubts in the beginning. I need to know how to test if a list is empty. As I always say, I come from PHP. So I used to do these forms: count($array) == 0 empty($array);...
asked by 15.10.2015 / 21:23
2
answers

How to predict values of a variable?

Live. I do not realize much or even nothing about predicting values. My problem is knowing how to predict future values of a certain variable based on a set of values previously noted ... Do you know where I can find tutorials that explain...
asked by 27.10.2014 / 21:12
4
answers

Print only the column of an array

I am a beginner in python and am having doubts about the use of list and tuple and their operators. I'm trying to print only the column of an array but I'm not getting it. I've tried to do the following to print the second column: matriz = [[1...
asked by 24.09.2015 / 15:50
3
answers

Doubt with Python's str.replace () method

I have the following text:    'box 1 is blue, box 10 is green, box 100 is empty' I want to replace 'box 1' with 'package 2', so I do: >>> texto = 'caixa 1 é azul, caixa 10 está verde, caixa 100 está vazia' >>> print(te...
asked by 30.08.2015 / 19:49
1
answer

How to convert a string to base64 in Python?

I'm starting in Python and I'm coming from PHP . To convert a string to base 64 in PHP, I do it as follows: base64_encode('stack overflow'); //c3RhY2sgb3ZlcmZsb3c= And in Python , how do I do this?     
asked by 16.10.2015 / 17:18
2
answers

I can not get floats return by expressions

When I try to give print(6/10) I get a int (0) instead of a float (0.6) And if I give type(6/10) it returns int . I'm following this tutorial and doing exactly the same steps both in pyCharm and in IDLE,...
asked by 27.02.2015 / 08:31
1
answer

Working @classmethod

I'd like to get a better understanding of the @classmethod annotation of Python. Briefly, it works as a second constructor alternative. But what are the benefits? When to use? @classmethod def from_teste(cls, teste): How does cls...
asked by 08.04.2015 / 21:03
3
answers

How to detect if a variable is null?

I'm trying to validate a simple form in Python 3 and I want to prevent it from registering the information if the nome field is empty, but when I make a if to check that the name variable is empty, it it returns me that it i...
asked by 31.07.2017 / 02:11