This question is related to
This question on Aardvark
This question on here
The past couple of years I've been thinking about things I like and don't like about languages I use. I always wanted to write my own language, but never did so.
I also own both the Lego RCX and NXT, but most of the time I never actually make my robots do an...
What should be a fairly simple regex extraction is confounding me. Couldn't find a similar question on SO, so happy to be pointed to one if it exists. Given the following HTML:
<h1 class="title">Title One</h1><p><a href="#">40.5</a><a href="#">31.3</a></p>
<h1 class="title alternate">Title Two</h1><p><a href="#">12.1</a><a href="#">8...
I want to write a custom class that behaves like dict - so, I am inheriting from dict.
My question though is that do I need to create a private dict member in my init() method?. I dont see the point of this, since I already have the dict behaviour if I simply inherit from dict.
Can anyone point out why most of the inheritance snippets ...
I wish to control my computer (and usb devices attached to the computer) at home with any computer that is connected to the internet. The computer at home must have a program installed that receives commands from any other computer that is connected to the internet. I thought it would be best if I do this with a web interface as it would...
Hi All,
I am testing chardet in one of my scripts. I wanted to identify the encoding type of a result variable and chardet seems to do fine here.
So this is what I am doing:
myvar1 <-- gets its value from other functions
myvar2 = chardet.detect(myvar1) <-- to detect
the encoding type of myvar1
Now when I do a print myvar2,...
Let's say I'm working in the Python shell and I'm given a function f. How can I access the string containing its source code? (From the shell, not by manually opening the code file.)
I want this to work even for lambda functions defined inside other functions.
...
Hey,
I have a method which I will accept either a single object or a list of objects. I want to add whatever is passed to another list. Currently, my method looks like this:
def appendOrExtend(self, item):
if type(item).__name__ == "list":
self.list.extend(item)
else:
self.list.append(item)
It seems to me that there shoul...
I've have asked these questions before with no proper answer. I hope I'll get some response here.
I'm developing an instant messenger in python and I'd like to handle video/audio streaming with VLC. Tha basic idea right now is that in each IM client I'm running one VLC instance that acts as a server that streams to all the users I want...
How to serialize dajngo model in json format if i want include foreign key models fields.
If i have:
class Model1(models.Model):
name=models.CharField()
child=models.ForeignKey(Model2)
class Mode2(models.Model):
field1=models.CharField()
field2=models.IntegerField()
I wanna include everything in js...
I have a master/worker model implemented with separate python processes. The master process holds job/result lists which are protected by mutexes. Many workers run on many machines (about 200 worker processes).
I have noticed that on each machine the workers tend to do 0-20% more or less work than other worker processes and that the mac...
Is there any reason for a class declaration to inherit object?
I just found some code that does this and I can't find a good reason why.
class MyClass(object):
# class code follows...
The code is using swig for binding some C code to Python, if that's relevant.
...
Which compression method in Python has the best compression ratio?
Is the commonly used zlib.compress() the best or are there some better options? I need to get the best compression ratio possible.
I am compresing strings and sending them over UDP. A typical string I compress has about 1,700,000 bytes.
...
This is something that I've been questioning for some time. How would I create a variable at runtime as named by the value of another variable. So, for example, the code would ask the user to input a string. A variable would then be created named after that string with a default value of "default". Is this even possible?
...
I want to establish a standard script file that is imported into python at startup using the PYTHONSTARTUP environment variable. Additionally, I want to be able to conveniently reload the same script file after modifying it in an external editor, to test its behavior after the modification.
I created a ~/.pythonrc.py file and set it as P...
I want to keep my main .hgrc in revision control, because I have a fair amount of customization it in, but I want to have different author names depending on which machine I'm using (work, home, &c.).
The way I'd do this in a bash script is to source a host-local bash script that is ignored by Mercurial, but I'm not sure how to do this ...
I downloaded the python client for magento from
Here But When I am downloading is using python setup.py install then it shows following error. How can i rectify this error?
error:
File "setup.py", line 31, in <module>
import magento
File "/home/sam/Downloads/magento-0.1.1/magento/__init__.py", line 21, in <module>
from api...
Hey guys,
I have a problem when I import classes from one to another. I have
those classes in different modules:
crm.py
from CRMContactInformation import CRMContactInformation
class CRM(rdb.Model):
"""Set up crm table in the database"""
rdb.metadata(metadata)
rdb.tablename("crms")
id = Column("id", In...
I have created a Python Program that converts strings into images at run time , using PIL's Image Draw module.
I want to run this program interfaced with a simple web form that should display a text field to input the string and on pressing a button , it should display the string converted as an image.
Would be a great deal of help if...
After installing Python 2.7 on Windows XP, then manually setting the %PATH% to python.exe (why won't the python installer do this?), then installing setuptools 0.6c11 (why doesn't the python installer do this?), then manually setting the %PATH% to easy_install.exe (why doesn't the installer do this?), I finally tried to install a python ...
Hi,
Looking for few days for some simple solution for this, but I think that in this moment I am still on the beginning :)
I need good web crawler written in Python to store complete page into mysql database. Small system that I am experimenting uses now PHP Sphider to crawl and store into database. I need something that works almost ex...