I'm about to build a piece of a project that will need to build and post an xml document to a web service, and I'd like to do it in Python as a means to expand my skills there. Unfortunately, while I know the XML model fairly well in .Net, I'm uncertain what the pros and cons are of the XML models in Python.
Anyone have experience do...
I am using the Photoshop's javascript API to find the fonts in a given PSD.
Given a font name returned by the API, I want to find the actual physical font file that that corresponds to on the disc.
This is all happening in a python program running on OSX so I guess I'm looking for one of:
Some Photoshop javascript
A Python function
A...
I have a cross platform (python) application which needs to generate a jpeg preview of the first page of a PDF.
On the mac I am spawning sips. Is there something similarly simple I can do on Windows?
...
I'm starting work on a hobby project with a python codebase and would like to set up some form of continuous integration (i.e. running a battery of test-cases each time a check-in is made and sending nag e-mails to responsible persons when the tests fail) similar to CruiseControl or TeamCity.
I realize I could do this with hooks in most...
How do I get started?
...
There are several ways, what is the best one?
...
I don't remember whether I was dreaming or not but I seem to recall there being a function which allowed something like,
foo in iter_attr(array of python objects, attribute name)
I've looked over the docs but this kind of thing doesn't fall under any obvious listed headers...
I am quite fond of the Intellisense code completion baked into Microsoft Visual Studio. I find that I only type 2 to 4 characters of any given keyword which drasticaly speeds up my coding. Now that I have been spending time writing some Python code I find myself reaching for ctrl+space.
Are there any IDEs that support code completion i...
Django view points to a function, which can be a problem if you want to change only a bit of functionality. Yes, I could have million keyword arguments and even more if statements in the function, but I was thinking more of an object oriented approach.
For example, I have a page that displays a user. This page is very similar to page th...
I can get Python to work with Postgresql but I cannot get it to work with MySQL. The main problem is that on the shared hosting account I have I do not have the ability to install things such as Django or PySQL, I generally fail when installing them on my computer so maybe it's good I can't install on the host.
I found bpgsql really goo...
I haven't been able to find an understandable explanation of how to actually use Python's itertools.groupby() function. What I'm trying to do is this: take a list - in this case, the children of an objectified lxml element - divide it into groups based on some criteria, and then later iterate over each of these groups separately.
I've...
I have been dabbling in Python for a couple months now, read the online docs/tutorial and started playing with Django a bit as well... and I feel like I am starting to leave my formative toddler years and ready for some more serious code. Most everything I see is generally encapsulated in a single script or so large and unwieldy I don't ...
I've read that it is possible to add a method to an existing object (e.g. not in the class definition) in python, I think this is called Monkey Patching (or in some cases Duck Punching). I understand that it's not always a good decision to do so. But, how might one do this?
And if you don't know python, can your language of choice do t...
I need to be able to manipulate a large (10^7 nodes) graph in python. The data corresponding to each node/edge is minimal, say, a small number of strings. What is the most efficient, in terms of memory and speed, way of doing this?
A dict of dicts is more flexible and simpler to implement, but I intuitively expect a list of lists to be...
How do you express an integer as a binary number with Python literals?
I was easily able to find the answer for hex:
>>> 0x12AF
4783
>>> 0x100
256
and, octal:
>>> 01267
695
>>> 0100
64
How do you use literals to express binary in Python?
Summary of Answers
Python 2.5 and earlier: can express bi...
I've got a menu in python. That part was easy. I'm using raw_input() to get the selection from the user.
The problem is that raw_input (and input) require the user to press Enter after they make a selection. Is there any way to make the program act immediately upon a keystroke? Here's what I've got so far:
import sysprint """Menu1) Sa...
What do I need to look at to see if I'm on Windows, Unix, etc?
...
In many places,(1,2,3) and [1,2,3] can be used interchangably.
When should I use one or the other, and why?
...
I had an PHP script to update the webserver from a local directory.
I'm migrating the script into Python, it works almost OK but after a PUT command the size of the file
in the server isn't the same as the local file. Once I download again the file from the FTP server,
the only difference is the CR/LF mark. It annoys me because the same ...
I have been using django a great deal lately and would like to find a home to host my apps.
What is the best django web host? (Official django support preferred)
Which service has the lowest price (without a long contract)?...