Skip to main content
Filter by
Sorted by
Tagged with
59 votes
10 answers
33k views

I am writing a little application to download files over http (as, for example, described here). I also want to include a little download progress indicator showing the percentage of the download ...
cschol's user avatar
  • 13.1k
12 votes
1 answer
952 views

How do you create a weak reference to an object in Python?
readonly's user avatar
  • 358k
603 votes
26 answers
637k views

I have scripts calling other script files but I need to get the filepath of the file that is currently running within the process. For example, let's say I have three files. Using execfile: script_1....
Ray's user avatar
  • 194k
37 votes
10 answers
48k views

Is there an open-source alternative to MATLAB's fmincon function for constrained linear optimization? I'm rewriting a MATLAB program to use Python / NumPy / SciPy and this is the only function I haven'...
dF.'s user avatar
  • 76.1k
14 votes
7 answers
8k views

Using the zip function, Python allows for loops to traverse multiple sequences in parallel. for (x,y) in zip(List1, List2): Does MATLAB have an equivalent syntax? If not, what is the best way to ...
Jason's user avatar
  • 141
21 votes
3 answers
9k views

How do I turn a python program into an .egg file?
minty's user avatar
  • 22.4k
74 votes
7 answers
146k views

I would like to call python script files from my c++ program. I am not sure that the people I will distribute to will have python installed.
Brian R. Bondy's user avatar
8 votes
2 answers
4k views

I was wondering if anyone here had some experience writing this type of script and if they could give me some pointers. I would like to modify this script to validate that the check-in file does not ...
Julien Nephtali's user avatar
5 votes
4 answers
2k views

You can embed the IPython shell inside of your application so that it launches the shell in the foreground. Is there a way to embed a telnet server in a python app so that you can telnet to a certain ...
readonly's user avatar
  • 358k
28 votes
6 answers
11k views

I've read some about .egg files and I've noticed them in my lib directory but what are the advantages/disadvantages of using then as a developer?
minty's user avatar
  • 22.4k
550 votes
13 answers
239k views

When should you use generator expressions and when should you use list comprehensions in Python? # Generator expression (x*2 for x in range(256)) # List comprehension [x*2 for x in range(256)]
readonly's user avatar
  • 358k
32 votes
3 answers
18k views

I work in a Windows environment and would prefer to deploy code to IIS. At the same time I would like to code in Python. Having read that IIS can run fastCGI application, I went to the IIS site where ...
minty's user avatar
  • 22.4k
15 votes
6 answers
5k views

If I was going to start an open source project using Python what version should I use to ensure that the vast majority of users can use it on their system? I'm the kind of person who quickly jumps to ...
Cristian's user avatar
  • 44.2k
7 votes
2 answers
2k views

I’ve writen a little python script that just pops up a message box containing the text passed on the command line. I want to pop it up only when the window —resulting from a previous call— is not open....
Tibi's user avatar
  • 530
9 votes
4 answers
4k views

If possible I want to catch pressure sensitive input from a Wacom tablet in Python. Are there any Python libraries available that can do this?
user avatar
19 votes
3 answers
4k views

I've been unable to find a source for this information, short of looking through the Python source code myself to determine how the objects work. Does anyone know where I could find this online?
user1114's user avatar
5 votes
1 answer
214 views

I know, I would have thought the answer was obviously "no" as well, but I am experiencing a strange situation where when I view my site from our staging server it appears slightly larger than when I ...
John's user avatar
  • 15.4k
725 votes
15 answers
943k views

What would be your preferred way to concatenate strings from a sequence such that between every two consecutive pairs a comma is added. That is, how do you map, for instance, ['a', 'b', 'c'] to 'a,b,c'...
mweerden's user avatar
  • 14.1k
44 votes
6 answers
8k views

What is the best way to layout a large django project? The tutorials provide simple instructions for setting up apps, models, and views, but there is less information about how apps and projects ...
rcreswick's user avatar
  • 16.9k
12 votes
11 answers
16k views

How do you insert invisible watermarks in images for copyright purposes? I'm looking for a python library. What algorithm do you use? What about performance and efficiency?
Grégoire Cachet's user avatar
18 votes
12 answers
13k views

Can you please tell me how much is (-2) % 5? According to my Python interpreter is 3, but do you have a wise explanation for this? I've read that in some languages the result can be machine-dependent,...
lurks's user avatar
  • 2,626
283 votes
19 answers
323k views

Let's say you want to save a bunch of files somewhere, for instance in BLOBs. Let's say you want to dish these files out via a web page and have the client automatically open the correct application/...
Daren Thomas's user avatar
  • 70.8k
97 votes
14 answers
176k views

Using PyObjC, you can use Python to write Cocoa applications for OS X. Can I write native iPhone apps using Python and if so, how?
davidmytton's user avatar
  • 39.4k
5 votes
1 answer
712 views

I'm trying to write a bzr post-commit hook for my private bugtracker, but I'm stuck at the function signature of post_commit(local, master, old_revno, old_revid, new_revno, mew_revid) How can I ...
Josh Matthews's user avatar
78 votes
3 answers
51k views

The Python docs say: re.MULTILINE: When specified, the pattern character '^' matches at the beginning of the string and at the beginning of each line (immediately following each newline)... By ...
cdleary's user avatar
  • 71.8k