will Python ever have LINQ like thing
Possible Duplicate: LINQ in Python Hi Will python ever have Microsoft LINQ ported to it . I find LINQ to be very cool ...
Possible Duplicate: LINQ in Python Hi Will python ever have Microsoft LINQ ported to it . I find LINQ to be very cool ...
I'm a little confused as to which one I should use. I think either will work, but is one better or more appropriate than the other? http://github.com/ask/carrot/tree/master http://github.com/ask/celery/tree/master ...
I have the string u"Played Mirror's Edge\u2122" Which should be shown as Played Mirror's Edge™ But that is another issue. My problem at hand is that I'm putting it in a model and then trying to save it to a database. AKA: a = models.Achievement(name=u"Played Mirror's Edge\u2122") a.save() And I'm getting : 'ascii' codec can...
My problem is: I would like to add to a Composite class Leaf objects created at runtime inside a Composite routine like this: def update(self, tp, msg, stt): """It updates composite objects """ d = Leaf() d.setDict(tp, msg, stt) self.append_child(d) return self.status() Inside main: import lib.composite c =...
I'm confused with file moving under python. Under windows commandline, if i have directory c:\a and a directory c:\b, i can do move c:\a c:\b which moves a to b result is directory structure c:\b\a If I try this with os.rename or shutil.move: os.rename("c:/a", "c:/b") I get WindowsError: [Error 17] Cannot create a file when that...
I am wanting to generate and store a CRC (or similar) value for a given list of files which can be used as a comparison at a later point. Writing a function to do this is simple enough, but is there a more standard way to do it within the Python libs? The value generated does not need to be of any particular standard. ...
I'm working on a small django project that will be deployed in a servlet container later. But development is much faster if I work with cPython instead of Jython. So what I want to do is test if my code is running on cPython or Jython in my settiings.py so I can tell it to use the appropriate db driver (postgresql_psycopg2 or doj.backend...
Usually when we search, we have a list of stories, we provide a search string, and expect back a list of results where the given search strings matches the story. What i am looking to do, is the opposite. Give a list of search strings, and one story and find out which search strings match to that story. Now this could be done with re b...
I need to upload a potentially huge plain-text file to a very simple wsgi-app without eating up all available memory on the server. How do I accomplish that? I want to use standard python modules and avoid third-party modules if possible. ...
How do I make python (local) run php script on a remote server? I don't want to process its output with python script or anything, just execute it and meanwhile quit python (while php script will be already working and doing its job). edit: What I'm trying to achieve: python script connects to ftp server and uploads php script (I al...
Is there a way to put together Python files, akin to JAR in Java? I need a way of packaging set of Python classes and functions, but unlike a standard module, I'd like it to be in one file. ...
I've want to implement a scroll/pan-feature on a QGraphicsView in my (Py)Qt application. It's supposed to work like this: The user presses the middle mouse button, and the view scrolls as the user moves the mouse (this is quite a common feature). I tried using the scroll() method inherited from QWidget. However, this somehow moves the vi...
Because the Twisted getPage function doesn't give me access to headers, I had to write my own getPageWithHeaders function. def getPageWithHeaders(contextFactory=None, *args, **kwargs): try: return _makeGetterFactory(url, HTTPClientFactory, contextFactory=contextFactory, ...
How can I break a long one liner string in my code and keep the string indented with the rest of the code? PEP 8 doesn't have any example for this case. Correct ouptut but strangely indented: if True: print "long test long test long test long test long \ test long test long test long test long test long test" >>> long test long te...
I have to download some files from an FTP server. Seems prosaic enough. However, the way this server behaves is if the file is very large, the connection will just hang when the download ostensibly completes. How can I handle this gracefully using ftplib in python? Sample python code: from ftplib import FTP ... ftp = FTP(host) ftp.l...
I was thinking about a code that I wrote a few years ago in Python, at some point it had to get just some elements, by index, of a list of lists. I remember I did something like this: def getRows(m, row_indices): tmp = [] for i in row_indices: tmp.append(m[i]) return tmp Now that I've learnt a little bit more sinc...
I have a file in UTF-8, where some lines contain the U+2028 Line Separator character (http://www.fileformat.info/info/unicode/char/2028/index.htm). I don't want it to be treated as a line break when I read lines from the file. Is there a way to exclude it from separators when I iterate over the file or use readlines()? (Besides reading t...
My specific situation Property management web site where users can upload photos and lease documents. For every apartment unit, there might be 4 photos, so there won't be an overwhelming number of photo in the system. For photos, there will be thumbnails of each. My question My #1 priority is performance. For the end user, I want...
So the situation I have is that I have loaded more than one class that I've made that subclasses from asynchat, but I only want one of them to run. Of course, this doesn't work out when I call asyncore.loop() as they all begin. Is there any way to make only one of them begin running? edit: I think it has something to do with the map par...
I want a python function that takes a pdf and returns a list of the text of the note annotations in the document. I have looked at python-poppler (https://code.launchpad.net/~poppler-python/poppler-python/trunk) but I can not figure out how to get it to give me anything useful. I found the get_annot_mapping method and modified the demo ...