In SharpDevelop, I want to create a dll which contains a static methon, void Main(string[] args).
Some one said I should use decorator to restrict the function in IronPython.
I found "@staticmethod", but others, "void", "string[] args", how to restrict them?
class MyClass:
def __init__(self):
pass
@staticmethod
...
(There are other questions along these lines but none of them have any real answers, let alone answers dealing with python...)
I have a Windows Service (XP SP3) written in Python that needs to be able to mount a network drive for ALL users. I tried using net use with subprocess (even with the full path to net.exe), but given that your ...
I'm working on a turn-based web game that will perform all world updates (player orders, physics, scripted events, etc.) on the server. For now, I could simply update the world in a web request callback. Unfortunately, that naive approach is not at all scalable. I don't want to bog down my web server when I start running many concurre...
Hi,
I am writing a python application. I am trying to dump my python object into yaml using PyYaml. I am using Python 2.6 and running Ubuntu Lucid 10.04. I am using the PyYAML package in Ubuntu Package: http://packages.ubuntu.com/lucid/python/python-yaml
My object has 3 text variables and a list of objects. Roughly it is something like...
Hello,I want to match text inside double quotes and bracket as two groups by use regex, How can I do that?
from
“作為”(act) ,用於罪行或民事過失時,包括一連串作為、任何違法的不作為和一連串違法的不作為;
“行政上訴委員會”(Administrative Appeals Board) 指根據《行政上訴委員會條例》(第442章)設立的行政上訴委員會;(由1994年第6號第32條增補)
“成人”、“成年人”(adult)* 指年滿18歲的人; (由1990年第32號第6條修訂)
“飛機”、“航空器”(aircraft) 指任何可憑空氣的反作用而在大氣中獲...
I am trying to parse the keywords from google suggest, this is the url:
http://google.com/complete/search?output=toolbar&q=test
I've done it with php using:
'|<CompleteSuggestion><suggestion data="(.*?)"/><num_queries int="(.*?)"/></CompleteSuggestion>|is'
But that wont work with python re.match(pattern, string), I tried a few b...
I would like to be able to parse command line arguments in my python 2.6 program.
Ideally, I want to be able to handle these cases:
# show some help
./myprogram --help
# these are equivilent
./myprogram --block=1
./myprogram -b 1
# this means verbose, and twice as verbose:
./myprogram -v
./myprogram -vv
...
Now, I'm learning python but I'm PHP web developer. I don't interest about terminal and windows programming. I only want to do web development. So, Can I learn Django ?
...
Initialize an array of arrays:
M = [[]]*(24*60/5)
Append the number 2 to the 51st array in M
M[50].append(2)
What is in M?
...
[2]
[2]
[2]
[2]
[2]
[2]
[2]
[2]
...
Every element in M is the array [2]
What am I missing? I suspect that every [] that I initially initialize is a reference to the same space in memory.
...
I have a working Python script that executes an external command and calls Popen.communicate(). However when I call this script from a C process, it fails in os.waitpid() with "[Errno 10] No child processes". Why?
This looks like a certain bug in Python, but I'm not using threads.
The C process forks, changes its UID, GID, and calls se...
My hoster has refused installs python-openid module motivated by the fact that its not reasonably safe. "This package works as a Web server, which listens to its port on a virtual server." Is it true?
...
Does anyone know how to perform svd operation on a sparse matrix in python? it seems that their is no such functionality provided in scipy.sparse.linalg.
...
I've used the Selenium IDE to generate some test code for my application. The generated Python code for an assertion looks like this.
try: self.failUnless(sel.is_text_present("Path"))
except AssertionError, e: self.verificationErrors.append(str(e))
Instead of failing fast, the error is added to a list, and the script continues...
Hi guys,
Anyone know how to debug Python using PDB in Windows XP?
My system has some deadlock. I want to use PDB to track my system.
My Config: VC 2005, Python2.7
...
Hi all!
I have written python scripts that use scrapy,nltk and simplejson in my project but i need to run them from java as my mentor wants to deploy them on a server and i have very less time to do this.I took a glance at runtime.exec() in java and jython, needless to say that running system commands from java doesn't look simple eithe...
Is one preferred over the other? If so, in all cases or just a few?
I am intending to use some form of date class for keeping long lists of date and time data, e.g., '2009-01-01 10:12:00'.
...
I am using Python 2.6.5. My code requires the use of the "more than or equal to" sign. Here it goes:
>>> s = u'\u2265'
>>> print s
>>> ≥
>>> print "{0}".format(s)
Traceback (most recent call last):
File "", line 1, in
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2265'
in position 0: ordinal not in range(128)`...
Using wxPython, I created a taskbar icon and menu.
Everything works fine (in Windows at least) upon right-click of the icon: i.e., the menu is displayed, and automatically hidden when you click somewhere else, like on Windows' taskbar.
Now I do want to have the menu appear when the icon is left-clicked as well.
So I inserted a Bind() to...
Hello. I'm wondering if I can recv/send data on a raw socket before wrapping it - I've looked through the documentation and searched for it but couldn't find anything specific. What I basically want to do:
client, addr = listeningSocket.accept()
client.recv(32)
client.send(b'hello')
client.setblocking(0)
sslSocket = ssl.wrap_socket(clie...
I have a negative integer (4 bytes) of which I would like to have the hexadecimal form of its two's complement representation.
>>> i = int("-312367")
>>> "{0}".format(i)
'-312367'
>>> "{0:x}".format(i)
'-4c42f'
But I would like to see "FF..."
...