Am wondering if anyone might provide some conceptual advice on an efficient way to build a data model to accomplish the simple system described below. Am somewhat new to thinking in a non-relational manner and want to try avoiding any obvious pitfalls. It's my understanding that a basic principal is that "storage is cheap, don't worry ...
I am using Python and the Twisted framework to connect to an FTP site to perform various automated tasks. Our FTP server happens to be Pure-FTPd, if that's relevant.
When connecting and calling the list method on an FTPClient, the resulting FTPFileListProtocol's files collection does not contain any directories or file names that conta...
Is there a way to find all nodes in a xml tree using cElementTree? The findall method works only for specified tags.
...
The Python datetime.isocalendar() method returns a tuple (ISO_year, ISO_week_number, ISO_weekday) for the given datetime object. Is there a corresponding inverse function? If not, is there an easy way to compute a date given a year, week number and day of the week?
...
Im trying to get Trac upp and running on my IIS/w2008 server using this FAQ: TracOnWindowsIisAjp
Everything upp until "3. Install Tomcat AJP Connector for IIS" works ok.
I then define my directories as : C:\wwwroot\trac.evju.biz\AJP\, in the bin catalog I place the dll file, and 3 config files with this content:
isapi_redirect-1.2.26.p...
Say I am declaring a class C and a few of the declarations are very similar. I'd like to use a function f to reduce code repetition for these declarations. It's possible to just declare and use f as usual:
>>> class C(object):
... def f(num):
... return '<' + str(num) + '>'
... v = f(9)
... w = f(42)
...
>>> C.v...
Is it possible to use CPython to develop Adobe Flash based applications?
...
Hi, I just installed a linux system (Kubuntu) and was wondering if there is a program to make python programs executable for linux. Thanx in advance :)
...
I want to write a function that accepts a parameter which can be either a sequence or a single value. The type of value is str, int, etc., but I don't want it to be restricted to a hardcoded list.
In other words, I want to know if the parameter X is a sequence or something I have to convert to a sequence to avoid special-casing later. I...
For some reason I can't find online or in the docs the way to get the equivalents of sqlite's interactive shell commands:
.tables
.dump
in Python's sqlite3 API.
Is there anything like that? Am I missing something?
-N.
...
If any one can help me with Python code:
If I input a letter, How can I print all the words start with that word?
...
My application caches some data on disk. Because the cache may be large, it should not be stored on a network drive. It should persist between invocations of the application. I have a mechanism for the user to choose a location, but would like the default to be sensible and "the right thing" for the platform.
What is the appropriate ...
I have a function that takes another function as a parameter. If the function is a member of a class, I need to find the name of that class. E.g.
def analyser(testFunc):
print testFunc.__name__, 'belongs to the class, ...
I thought
testFunc.__class__
would solve my problems, but that just tells me that testFunc is a function....
I am trying to write a decorator to do logging:
def logger(myFunc):
def new(*args, **keyargs):
print 'Entering %s.%s' % (myFunc.im_class.__name__, myFunc.__name__)
return myFunc(*args, **keyargs)
return new
class C(object):
@logger
def f():
pass
C().f()
I would like this to print:
Entering C...
Why does the following behave unexpectedly in Python?
>>> a = 256
>>> b = 256
>>> a is b
True # this is an expected result
>>> a = 257
>>> b = 257
>>> a is b
False # what happened here? why is this False?
>>> 257 is 257
True # yet the literal numbers compare properly
I am using Python 2.5.2. Trying some di...
Let's say, as an example, I have the following list:
foo = ['a', 'b', 'c', 'd', 'e']
What is the best way to retrieve an item at random from this list?
...
How can I get a list of the running applications? I'm referring to the ones in the panel at the bottom of the screen.
...
I'm searching for an easy to handle python native module to create python object representation from xml.
I found several modules via google (one of them is XMLObject) but didn't want to try out all of them.
What do you think is the best way to do such things?
EDIT: I missed to mention that the XML I'd like to read is not generated b...
I have been able to zip the contents of my folder. But I would like the zipped file to remain in the folder that was just compressed. For example, I've zipped a folder called test in my C: drive. But I would like my "test.zip" file to be contained in C:\test. How can I do this? Thanks in advance.
clarification of question with code exam...
When I run a wxPython application, it prints the string Redirecting output to win32trace remote collectorand I must open PythonWin's trace collector tool to view that trace output.
Since I'm not interested in collecting this output, how should I disable this feature?
...