Tagged Questions
Python is a dynamic and strongly typed programming language that is designed to emphasize usability. Two similar but incompatible versions of Python are in widespread use (2 and 3). Please consider mentioning the version and implementation that you are using when asking a question about Python.
0
votes
0answers
2 views
standart input in python
I'm beginner in Python and I'm trying to read two numbers in a simple programming contest problem.
# Codeforces New Year 2013 Contest;
# http://codeforces.com/contest/379/problem/A
import sys;
def ...
0
votes
0answers
6 views
Raster scan pattern python
I am trying to create a list of xy positions that represent a raster scan pattern like below:
Simply put I am using nested loops and if else statements but it is getting messy. Is there a simple ...
0
votes
0answers
6 views
Curve is not continuous in matplotlib for python 3
This is my program to graph functions and it works great. There is only one problem.
while 1==1:
import numpy as np
import matplotlib.pyplot as plt
print("FUNCTION GRAPHER")
def ...
0
votes
1answer
4 views
PyUserInput and Xlib crashing
I'm using the PyUserInput python library that takes advantage of the python xlib library. When I use the mouse movements, I will randomly get an error. Reproduced here:
Traceback (most recent call ...
0
votes
0answers
4 views
Establishing connection between client and Google App Engine server
I have a need for my client(s) to send data to my app engine application that should go something like this:
Client --> Server (This is the data that I have)
Server --> Client (Based on what ...
1
vote
0answers
7 views
Eager Loading Adjacency List Relationship
I have the database schema below
class Node(Base):
__tablename__ = 'node'
id = Column(Integer, primary_key=True)
parent_id = Column(Integer, ForeignKey('node.id'))
data = ...
0
votes
1answer
34 views
i have “list index out of range” in python, but i dont understand why
datos = {"nombre": "Juan","apellido1": "Perez",
"apellido2": "Palma","sexo": "M","codigo":"30","ingreso": "2009"}
def generar_rol(datos):
from definiciones import digito_verificador
...
0
votes
1answer
17 views
Function Grapher in Python 3.4 says 'float is not interpreted as an integer'?
import numpy as np
import matplotlib.pyplot as plt
print("FUNCTION GRAPHER")
def graph(formula,domain):
x = np.array(domain)
y = eval(formula)
plt.plot(x, y)
plt.show()
...
-2
votes
4answers
30 views
Binary literal to Binary string conversion in python
I want to convert binary literal like 0b01011 into the binary string like 0101101101 .
How i should go in here.
here suppose A=81 (hex)
>>> a = bin(int(str('A'),16))
>>> print a
...
-1
votes
1answer
41 views
parsing a file in python with for loop
I am trying to parse a file with a limited knowledge in python with some loops but seems I'm doing something wrong. I want to get the genes(sp...) if values in lst are between the numbers in the ...
0
votes
2answers
30 views
a single method call for many instances
I have a function update() in a Character class such that every time an instance of the class character is made, the update method needs to be called in the main loop for example:
troll = Character()
...
0
votes
0answers
8 views
Creating A Custom Listbox - Tkinter
I am messing around with tkinter and I am trying to create a custom listbox. The code I have so far works but I would like to set a different default width for for this widget but I can't figure out ...
-1
votes
0answers
17 views
Python socket unknown error
I have an unknown problem with my socket chat.
The script seems work for me, but other people those try to use the client can't connect to the server.
This is my Server:
# Echo server program
import ...
5
votes
2answers
44 views
Python: list.sort() query when list contains different element types
Greetings Pythonic world. Day 4 of learning Python 3.3 and I've come across a strange property of list.sort.
I created a list of five elements: four strings, with a number in the middle. Trying to ...
2
votes
1answer
39 views
efficiently Iterating with numpy
I made code that calculates the average value for each element in period p for array y
import numpy as np
p=4
y =np.asarray([146, 96, 59, 133, 192, 127, 79, 186, 272, 155, 98, 219])
c=len(y)/p
...