Questions tagged as 'python'

2
answers

Random distribution in lists with python

I have a list: li = [0, 0, 2313, 1221, 0, 1333, 66, 0, 0, 0, 0] and another list of lists, where: The list of lists is called disciplines (below). The lists that are within disciplines, are specified below also: #essas são as listas...
asked by 19.06.2016 / 04:28
1
answer

Have two versions of Python on OSX without overwriting

Is there a way to install Python's 3.x version without overwriting the pre-installed (essential) version of OSX? I already know virtualenv but I'd like to avoid it, because I only use Python to study. Is there any way to keep both versi...
asked by 20.08.2015 / 00:45
1
answer

Difference between Father .__ init (self) and super (Father, self) .__ init __ ()

I'm a bit doubtful about the inheritance issue in python . In the following test, I expected that quack would print the same value for the two classes I created: class A(object): a,b = (None, None) def __init__(self):...
asked by 12.12.2015 / 23:40
1
answer

Dictionary Creation of Graph Returning integers

I'm implementing a Python code to create Graph with open (filename, "r") as f: d = {} for line in f: key, value = line.split() if key not in d: d[key] = [value] else: d[key].append(value)...
asked by 07.12.2015 / 23:20
1
answer

What is the difference between 'dump' and 'dumps' from the Pickle module in Python?

I've read the Python documentation and also Pickle's own, but I was not able to assimilate the content (lack of examples). On the Web I only found information on how to use dump + load and nothing on dumps + loads     
asked by 15.05.2015 / 01:38
1
answer

What plugin use to be able to commit in GitHub using PyCharm?

I'm a beginner in Python and would like to know which plugin is needed to start GitHub using PyCharm.     
asked by 10.06.2015 / 22:34
1
answer

Functions in Python

I did this Python exercise, version 2.7:    Instructions       First, define (def) a function called cube (cube) that   takes an argument called number. Do not forget the   parentheses and colon!       Make this function return (return) the...
asked by 07.08.2015 / 14:45
1
answer

List element zeros after loop for

I created a vector and filled it with 100 [0] (because I do not know a better way to do this) and after that I wanted to change those values using a for loop inside another for loop. But what happens is that after the loop inside, when i...
asked by 23.10.2015 / 18:13
2
answers

Clock in Python does not update

I'm trying to create a clock in PyGTK. But it looks like it gave some semantic error here: #!/usr/bin/env python2 # -*- coding: utf-8 -*- import pygtk pygtk.require('2.0') import gtk from datetime import * def relogio(): janela = gtk.Win...
asked by 23.10.2015 / 00:58
1
answer

Arduino UNO restarts when using serial port outside the IDE

My Arduino UNO is restarting when I use its serial port with a Python script. But when I open the serial terminal through the Arduino IDE and run the same Python script, it works normally. Why does this happen and how do I resolve it? Arduino...
asked by 22.06.2014 / 05:54