Hi there,
I need to generate a ton of lists in Python. Every list is of length 13, and I have 4 possible values that can go into each element. These are [1, -1, i, -i], but it could be whatever.
Thus I should get 4 * 4 * 4 ... * 4 = 4^13 = 67,108,864 lists, or more generally, m^n, given the info in the subject.
I tried the combination...
I have a couple small projects that I want to use to learn python
what version should I be using if I want to move to scripting for maya, blender, etc later.
also what resources are there for scripting for those programs
...
In general, is it reasonable to return None from a __new__ method if the user of the class knows that sometimes the constructor will evaluate to None?
The documentation doesn't imply it's illegal, and I don't see any immediate problems (since __init__ is not going to be called, None not being an instance of the custom class in question...
What's the equivalent type in types module for datetime? Example:
import datetime
import types
t=datetime.datetime.now()
if type(t)==types.xxxxxx:
do sth
I didn't find the relevent type in types module for the datetime type; could any one help me?
...
Compared to decorators applied to a function, it's not easy to understand the decorators applied to a class.
@foo
class Bar(object):
def __init__(self, x):
self.x = x
def spam(self):
statements
What's the use case of decorators to a class? How to use it?
...
My graph has Xticks Yticks , Xlabels , Ylabels .
My Code
firmwareList = self.firmware # Gets the list of all firmwares , this is a list
I need to put this firmware data under each bar .
Basically i need to put the build version below the X axis for each bar.
Example |
|
|
|
|
|
...
def makecounter():
return collections.defaultdict(int)
class RankedIndex(object):
def __init__(self):
self._inverted_index = collections.defaultdict(list)
self._documents = []
self._inverted_index = collections.defaultdict(makecounter)
def index_dir(self, base_path):
num_files_indexed = 0
allfiles = os.listd...
I am trying to learn more about the mechanics of executable files, but I have no background in assembler code. Is there any program I can use for this purpose? I would like to be able to pause a program in real time and read its memory dump at that instant. Is there anything like that for windows 7 32? What about for windows 7 64?
Thank...
I want to create a function to recursively traverse a multidimensional dictionary, where the dimensions are unknown.
Here is what I have come up with so far, but it doesn't seem to be working correctly. This will print out some key / values twice and they are not in order.
def walk_dict(d):
for k,v in d.items():
if isins...
Hi!
I want to extract data from such regex:
<td>[a-zA-Z]+</td><td>[\d]+.[\d]+</td><td>[\d]+</td><td>[\d]+.[\d]+</td>
I've found related question http://stackoverflow.com/questions/1327369/python-extract-contents-of-regex
but in my case I shoud iterate somehow.
...
mincut_value in igraph for python returns the number of edges of the cut. Can I find the what edges are actually are returned by this function and print them???
Thank you,
...
Hello guys. I could just have mod-python working on apache2 for the first time and I could play with PSP and Publisher handler a little by adding either
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
Or
AddHandler mod_python .psp
PythonHandler mod_python.psp
PythonDebug On
to /etc/apache2/sites-availab...
How do I modify a single character in a string, in Python? Something like:
a = "hello"
a[2] = "m"
'str' object does not support item assignment.
...
Is there a django.contrib.admin like app / module for cherrypy?
I really like the simplicity of cherrypy, but it would be nice, to have the user authentication and password management type things taken care of...
Or is it possible to run a cherrypy application behind the django admin app ?
...
I am running the following version of Python:
$ /usr/bin/env python --version
Python 2.5.2
I am running the following Python code to write data ...
Hi,
We have an in house developed web-based admin console that uses a combination of C CGI and Perl scripts to administer our mail server stack. Of late we have been thinking of cleaning up the code (well, replacing most of it), making the implementation more secure, and improving the overall behavior.
I don't have much programming kno...
I wouldn't have thought this would be so tricky. I'm trying to get something like this:
X | X
Where both Xs are ScrolledWindows that will ultimately contain lots of text and '|' is a "splitter" dividing the two. I want something about like most visual diffs give you. I can't seem to get this to work, though. My big problem now is th...
Is there a commandline tool to read a pdf file on linux.Please indicate the appropriate urls for this.
Thanks..
...
I have a list of objects and want to filter them according to some criteria. I can do it with list comprehension:
import datetime, pytz
# let's have a range of 100 hourly datetimes (just an example!):
dates = [ datetime.datetime(2010, 10, 1, 0, 0, 0, 0, pytz.utc) + datetime.timedelta(hours=i) for i in xrange(100) ]
# now I want a list ...
Getting the following kinds of warnings when running most python scripts in the command line:
/Library/Python/2.6/site-packages/virtualenvwrapper/hook_loader.py:16: UserWarning: Module
pkg_resources was already imported from /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.pyc, but /Library/Pyth...