Questions tagged as 'python'

1
answer

How to validate a script in PEP8?

I noticed some questions that asked about PEP8, something like "this way is correct?" , recent example: Problems with PEP8 Indentation Rules So the question has arisen, is there any way to know if the code is appropriate and which line...
asked by 03.12.2017 / 23:05
1
answer

Placing elements from a list in another list

I have the following code: a = list() b = list() c = list() a = (1,2,3) b = (2,4,6) c = a + b[1] print(c) How do I add an element from a list to another list?     
asked by 17.08.2016 / 04:57
3
answers

Capture the WHERE clause of an SQL query

I need to capture only the where clause of multiple queries to parse the filters used. For example: select "DIM_1"."col1", "DIM_2"."col2" , "DIM_3"."col3" , "DIM_4"."col4" , "FAT_1"."col5" from "FAT_1", "DIM_1", "DIM_2", "DIM_...
asked by 22.12.2016 / 19:05
3
answers

Searching for a list minimum by ignoring zero values

I have a list of values with elements zero and elements different from zero and wanted to return the lowest value of the list and its index, but ignoring the zeros, that is, the fact that there are zeros does not mean that it is the smallest val...
asked by 04.04.2016 / 20:04
3
answers

Read some lines from a file

I have a file with about 3 million lines. I have to read line by line and process some modifications, and after these changes in the line store the result in one list and then write to another file. The problem is performance. It's very slow....
asked by 23.04.2014 / 20:06
1
answer

Python - 'int' object is not iterable

Hello, I'm creating a character converter for your ascii code through a recursive function in Python. However I have an "int 'object is not iterable" problem. My code is this: def cod(n): for i in n: i = str(i) if len(n) == 1:...
asked by 09.12.2015 / 19:34
2
answers

How do I return a new instance of the python class itself dynamically inside it?

I am giving a study in Python and for this I am putting together a Python class that I had already done in PHP. For example, in a given method in PHP I needed to return the same instance of the class dynamically, but without usi...
asked by 18.05.2016 / 20:32
1
answer

Input in the Sublime Text builder

I'm using Sublime Text to study python, but it does not support input When running the following code with the sublime build: velocidade = int(input("Digite a velocidade: ")) I get the following error: Digite a velocidade: Trace...
asked by 07.03.2014 / 21:52
1
answer

Python connection problem Webhook

I have a question in my code. I'm using a sample code and tried to apply it to create a json template on the local machine. Follows what is working. It is located [in this link] ( link ): #!/usr/bin/env python import urllib import json im...
asked by 15.05.2017 / 06:13
1
answer

I can not change the state of an Entry () widget in Python and Tkinter

In my code, my Entry() state is originally as DISABLED . To enable the input, the user would need to check one of checkbuttons . Well, at least that's the idea. What happens is that I mark one of the boxes, but the entry is...
asked by 17.08.2015 / 14:10