a)In this case does the random number generator uses the system's clock (making the seed change) on each run?
b)Is the seed used to generate the pseudo-random values of expovariate(lambda)?
...
How do I generate a unique sission id in Python?
...
In python, is there a way to create a class that is treated like a dictionary but have the keys pre-defined when a new instance is created?
...
I saw a PyCon09 keynote presentation (slides: http://www.slideshare.net/kn0thing/ride-the-snake-reddit-keynote-pycon-09?c55) given by the reddit guys, and in it they mention a CSS compiler called C55. They said it would be open sourced soon. It looks cool - does anyone have more information about how it works, why they created it (aside ...
I'm having trouble with the Scatter function in the MPI4Py Python module.
My assumption is that I should be able to pass it a single list for the sendbuffer. However, I'm getting a consistent error message when I do that, or indeed add the other two arguments, recvbuf and root:
File "code/step3.py", line 682, in subbox_grid
i = m...
I understand that letting any anonymous user upload any sort of file in general can be dangerous, especially if it's code. However, I have an idea to let users upload custom AI scripts to my website. I would provide the template so that the user could compete with other AI's in an online web game I wrote in Python. I either need a soluti...
I'm beginner for the GUI programing using Tkinter, so who can tell me some useful sample codes which contains some useful codes.
...
I've been trying to learn about metaclasses in Python. I get the main idea, but I can't seem to activate the mechanism. As I understand it, you can specify M to be as the metaclass when constructing a class K by setting __metaclass__ to M at the global or class level. To test this out, I wrote the following program:
p = print
class M(t...
So what I'm trying to do is replace a string "keyword" with
"<b>keyword</b>"
in a larger string.
Example:
myString = "HI there. You should higher that person for the job. Hi hi."
keyword = "hi"
result I would want would be:
result = "<b>HI</b> there. You should higher that person for the job.
<b>Hi</b> <b>hi</b>."
I will not...
I'm trying to split a file with a list comprehension using code similar to:
lines = [x for x in re.split(r"\n+", file.read()) if not re.match(r"com", x)]
However, the lines list always has an empty string as the last element. Does anyone know a way to avoid this (excluding the cludge of putting a pop() afterwards)?
...
So, I've been tossing this idea around in my head for a while now. At its core, it's mostly a project for me to learn programming. The idea is that, I have a large set of data, my music collection. There are quite a few datasets that my music has. Format, artist, title, album, genre, length, year of release, filename, directory, just...
Is is possible to do this;
for i in range(some_number):
#do something
without the i? If you just want to do something x amount of times and don't need the iterator.
...
Hello everybody ,
I have a .txt file like:
Symbols from __ctype_tab.o:
Name Value Class Type Size Line Section
__ctype |00000000| D | OBJECT |00000004| |.data
__ctype_tab |00000000| r | OBJECT |00000101| |.rodata
Symbols from _ashldi3.o:
Name ...
I'm learning wxPython so most of the libraries and classes are new to me.
I'm creating a Preferences dialog class but don't know the best way to make sure the OK/Cancel (or Save/Close) buttons are in the correct order for the platform. This program is intended to run both on GNOME and Windows, so I want to make sure that the buttons are...
I have a list say:
['batting average', '306', 'ERA', '1710']
How can I convert the intended numbers without touching the strings?
Thank you for the help.
...
To clarify: I've been programming in C# for 5 years now, doing both Windows and Web development. I don't intend using Python for GUI development (I pretty much like WPF and Windows Forms).
Will I be more productive (deliver projects faster) with Python for console and web projects?
Does Python standard library allow developers to write...
Is there a simple way to order rows with unicode data in SQLite?
...
Hi to all,
I have one Python module that can be called by a CGI script (passing it information from a form) or from the command line (passing it options and arguments from the command line).
Is there a way to establish if the module has been called from the CGI script or from the command line ??
...
Hello, can you show me library for python which can detect (or decode - not nessecary) encoding of the string.
I found chardet but it's not that what i need.
Thanks.
...
Given an ip address (say 192.168.0.1), how do I check if it's in a network (say 192.168.0.0/24) in Python?
Are there general tools in Python for ip address manipulation? Stuff like host lookups, ip adddress to int, network address with netmask to int and so on? Hopefully in the standard Python library for 2.5.
...