Tagged Questions
Python is a dynamically and strongly typed programming language whose design philosophy emphasizes code readability. Two significantly different versions of Python (2 and 3) are in use. Please mention the version that you are using when asking a question about Python.
0
votes
0answers
3 views
Access dynamically created class instance variable, Kivy framework
Imagine following structure (I've cut most imho relevant parts):
class mymodificatorclass:
def callback(self,object):
print object
class generator(BoxLayout):
#(...)
def add(self, *l):
...
0
votes
0answers
2 views
django: regroup on inheritance child field
In a Django template, I try to regroup a list on a field which belong to a sub-model (multi-table inheritance).
my model.py
class Place(models.Model):
name = models.CharField(max_length=200)
...
0
votes
0answers
6 views
How to determine the callee details in a pythondecorator function?
My objective is to find the name of the file during a method execution. The main problem is I use a python decorator to transform a function. This decorator is in a separate file and being imported to ...
0
votes
1answer
21 views
Change Loop to Python List Comprehension
There is a list of objects, "games." How can I check to see if the object has an attribute set, and if it doesn't, set the attribute.... using list comprehensions?
for g in games:
if not ...
0
votes
0answers
4 views
Take a subset of dataframe as TextParser object
I am trying to read a csv files in chunks using pandas, but would only like to take a subset of the columns. I am trying to use
df = pandas.io.parsers.read_table(myData, chunksize=1000)
df = ...
0
votes
0answers
7 views
Created file contains all the results python lxml
I am currently using lxml for XSLT transformation in python. After transformation I have to write the content to different files. For better understanding my code is here as follows:
##function ...
1
vote
0answers
12 views
Connection is always refused while connecting through Tor Proxy
Hi i was trying to connect TOR with Socks Proxy and this is the code:
import StringIO
import socket
import urllib
import socks # SocksiPy module
import stem.process
from stem.util import term
...
1
vote
3answers
58 views
Is there any more compact way of writing that statement?
I had to write a script that generates some fixture file with increasing fake MAC addresses.
To do that, I decided to have some fun and try to make it as compact as I could. I ended up with:
def ...
2
votes
2answers
14 views
Python queue module difficulty
I'm an experienced programmer, but completely new to Python.
I've resolved most difficulties, but I can't get the queue module to work.
Any help gratefully received. Python 3.2.
Reduced to its basic ...
0
votes
1answer
11 views
Using Argparse to Create Calculator
I am making a basic calculator using argparse. I basically accept some numbers from the command line followed by either add,subtract,multiply,or divide action. I only have the adding part right now.
...
0
votes
1answer
29 views
Write dictionary values (list) to output file - Python
I am trying to print values(a list) from a dictionary to the third column of another file that contains the dictionary key in the first column. I would like the list of values to print in the third ...
0
votes
0answers
4 views
Unable to select popup window/iframe using selenium webdriver in python
I clicked on a link which opens a small window/popup/iframe and the popup window has Xpath:
//html/body/div[2]
ie. it has no window_id but in firebug the identifier shows the window as a <div ...
0
votes
1answer
16 views
how to delete multiple columns in one pass
How can I delete multiple columns in one pass? I know this works
del df['A']
del df['B']
but
del df[['A', 'B']]
doesn't.
0
votes
0answers
3 views
Scope to be used for editting Python Variables' syntax in Default Color Scheme's .tmTheme file
I think there are more sophisticated ways to do change syntax highlighting, which I am unable to follow very at this time. Hence I tried, what I thought was a simpler way i.e. by modifying one of the ...
0
votes
0answers
5 views
problems with installing constraint libraries in python
I have installed two constraint programming libraries in python but both of them aren't working due to a psyco error, may someone help me?
the two libraries are:
constraint.
logilab constraint.
...