title
stringlengths
10
172
question_id
int64
469
40.1M
question_body
stringlengths
22
48.2k
question_score
int64
-44
5.52k
question_date
stringlengths
20
20
answer_id
int64
497
40.1M
answer_body
stringlengths
18
33.9k
answer_score
int64
-38
8.38k
answer_date
stringlengths
20
20
tags
listlengths
1
5
Python classes -- mutability
1,355,555
<p>Im having a problem with python.. I have a binary tree node type:</p> <pre><code>class NODE: element = 0 leftchild = None rightchild = None </code></pre> <p>And I had to implement a function deletemin:</p> <pre><code>def DELETEMIN( A ): if A.leftchild == None: retva...
1
2009-08-31T02:26:42Z
1,355,636
<pre><code>class Node: element = 0; left_child = None right_child = None def delete_min( A ): if A.left_child is None: return A.right_child else: A.left_child = delete_min(A.left_child) return A tree = delete_min(tree) </code></pre>
0
2009-08-31T03:05:34Z
[ "python", "class" ]
How does this Python code work?
1,355,710
<p>I don't know if it is feasable to paste all of the code here but I am looking at the code in <a href="http://github.com/cloudkick/libcloud/tree/master" rel="nofollow">this git repo</a>.</p> <p>If you look at the example they do: </p> <pre><code>ec2 = EC2('access key id', 'secret key') </code></pre> <p>...but ther...
0
2009-08-31T03:51:50Z
1,355,735
<p>Checking out the libcloud\examples.py might be helpful. I saw this:</p> <pre><code>from libcloud.drivers import EC2, Slicehost, Rackspace </code></pre> <p>The python 'import' statement brings in the class from other python module, in this case from the libcloud.drivers module.</p>
0
2009-08-31T04:04:27Z
[ "python", "code-review" ]
How does this Python code work?
1,355,710
<p>I don't know if it is feasable to paste all of the code here but I am looking at the code in <a href="http://github.com/cloudkick/libcloud/tree/master" rel="nofollow">this git repo</a>.</p> <p>If you look at the example they do: </p> <pre><code>ec2 = EC2('access key id', 'secret key') </code></pre> <p>...but ther...
0
2009-08-31T03:51:50Z
1,355,744
<p><code>example.py</code> includes an <code>import</code> statement that reads:</p> <pre><code>from libcloud.drivers import EC2, Slicehost, Rackspace </code></pre> <p>This means that the <code>EC2</code> class is imported from the <code>libcloud.drivers</code> module. However, in this case, <code>libcloud.drivers</c...
5
2009-08-31T04:09:56Z
[ "python", "code-review" ]
Is there a stable integration procedure/pluggin for Django 1.1 and Google app engine?
1,355,813
<p>What is the best procedure/plugging to use to integrate django and google app engine? I have read many articles in the internet and seen videos on how to go round this. Am still left wondering which is the best procedure to use. </p> <p>Is there an official procedure documented in django or google app engine. Examp...
1
2009-08-31T04:41:00Z
1,355,859
<p>There is NO way you can run Python 2.6 on App Engine: it's 2.5 only.</p> <p>If you're rarin' to have Django 1.1 (with Python 2.5), I suggest <a href="http://code.google.com/p/app-engine-patch/" rel="nofollow">app-engine patch</a> which now supports it (it's a release candidate, not a final release, but close). I fi...
3
2009-08-31T05:01:49Z
[ "python", "django", "google-app-engine" ]
Creating GUI with Python in Linux
1,355,918
<p>Quick question.</p> <p>I'm using Linux and I want to try making a GUI with Python. I've heard about something like Qt, GTK+ and PyGTK but I don't know what they are exactly and what the difference between them is.</p> <p>Is there any difference on how they work with different DEs like GNOME, KDE, XFCE etc.? Is the...
11
2009-08-31T05:25:00Z
1,355,923
<p>Your first step should be <a href="http://wiki.python.org/moin/GuiProgramming" rel="nofollow">http://wiki.python.org/moin/GuiProgramming</a></p> <p>Some tool-kits integrate better in one environment over the other. For example PyQt, PyKDE (and the brand new <a href="http://www.pyside.org/" rel="nofollow">PySide</a>...
12
2009-08-31T05:27:14Z
[ "python", "linux", "user-interface", "gtk", "pygtk" ]
Creating GUI with Python in Linux
1,355,918
<p>Quick question.</p> <p>I'm using Linux and I want to try making a GUI with Python. I've heard about something like Qt, GTK+ and PyGTK but I don't know what they are exactly and what the difference between them is.</p> <p>Is there any difference on how they work with different DEs like GNOME, KDE, XFCE etc.? Is the...
11
2009-08-31T05:25:00Z
1,355,948
<p>Each desktop environment uses a specific toolkit to build it's components. For example, KDE uses Qt and GNOME uses Gtk. </p> <p>Your use of a toolkit will be dependent upon what type of desktop environment you're targeting at, and if you want to target a wide range of desktops then use a toolkit which will work on ...
2
2009-08-31T05:36:38Z
[ "python", "linux", "user-interface", "gtk", "pygtk" ]
Creating GUI with Python in Linux
1,355,918
<p>Quick question.</p> <p>I'm using Linux and I want to try making a GUI with Python. I've heard about something like Qt, GTK+ and PyGTK but I don't know what they are exactly and what the difference between them is.</p> <p>Is there any difference on how they work with different DEs like GNOME, KDE, XFCE etc.? Is the...
11
2009-08-31T05:25:00Z
1,355,988
<p>I would avoid using another language to make a GUI for Python. </p> <p>I've had every good luck with wxwidgets, which is the python binding for WX, a cross-platform development system. It's pretty easy to learn and quite powerful. The problem with wxwidgets is that it is not installed by default, so your users will...
4
2009-08-31T05:52:54Z
[ "python", "linux", "user-interface", "gtk", "pygtk" ]
Creating GUI with Python in Linux
1,355,918
<p>Quick question.</p> <p>I'm using Linux and I want to try making a GUI with Python. I've heard about something like Qt, GTK+ and PyGTK but I don't know what they are exactly and what the difference between them is.</p> <p>Is there any difference on how they work with different DEs like GNOME, KDE, XFCE etc.? Is the...
11
2009-08-31T05:25:00Z
1,358,089
<p>Use the <a href="http://glade.gnome.org/" rel="nofollow">glade UI designer</a> and pyGtk bindings... that was my first ever experience with python and there are <a href="http://www.google.com/search?q=python+glade+pygtk&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=com.ubuntu%3Aen-US%3Aunofficial&amp;client=firefox-a" ...
1
2009-08-31T15:49:40Z
[ "python", "linux", "user-interface", "gtk", "pygtk" ]
Creating GUI with Python in Linux
1,355,918
<p>Quick question.</p> <p>I'm using Linux and I want to try making a GUI with Python. I've heard about something like Qt, GTK+ and PyGTK but I don't know what they are exactly and what the difference between them is.</p> <p>Is there any difference on how they work with different DEs like GNOME, KDE, XFCE etc.? Is the...
11
2009-08-31T05:25:00Z
1,378,336
<p>Use PyGTK. As important as the toolkit is its underpinnings, with PyGTK you use GLib as well, with its filesystem abstractions (python module gio) that are very important for the Linux desktop, its high-level cross-desktop functions such as <a href="http://library.gnome.org/devel/pygobject/stable/glib-functions.html...
0
2009-09-04T10:06:26Z
[ "python", "linux", "user-interface", "gtk", "pygtk" ]
How to call super() in Python 3.0?
1,355,931
<p>I have the strangest error I have seen for a while in Python (version 3.0).</p> <p>Changing the signature of the function affects whether <code>super()</code> works, despite the fact that it takes no arguments. Can you explain why this occurs?</p> <p>Thanks,</p> <p>Chris</p> <pre><code>&gt;&gt;&gt; class tmp: .....
0
2009-08-31T05:30:09Z
1,355,947
<p>python 3.0 new super is trying to dynamically make a choice for you here, read this PEP <a href="http://www.python.org/dev/peps/pep-3135/" rel="nofollow">here</a> that should explain everything.</p>
1
2009-08-31T05:36:25Z
[ "python", "python-3.x" ]
How to call super() in Python 3.0?
1,355,931
<p>I have the strangest error I have seen for a while in Python (version 3.0).</p> <p>Changing the signature of the function affects whether <code>super()</code> works, despite the fact that it takes no arguments. Can you explain why this occurs?</p> <p>Thanks,</p> <p>Chris</p> <pre><code>&gt;&gt;&gt; class tmp: .....
0
2009-08-31T05:30:09Z
1,355,951
<p>As <a href="http://docs.python.org/3.1/library/functions.html?#super" rel="nofollow">the docs</a> say, "The zero argument form automatically searches the stack frame for the class (<code>__class__</code>) and the first argument." Your first example of <code>__new__</code> doesn't HAVE a first argument - it claims i...
6
2009-08-31T05:39:08Z
[ "python", "python-3.x" ]
How do I line up text from python into columns in my terminal?
1,356,029
<p>I'm printing out some values from a script in my terminal window like this:</p> <pre><code>for i in items: print "Name: %s Price: %d" % (i.name, i.price) </code></pre> <p>How do I make these line up into columns?</p>
7
2009-08-31T06:08:43Z
1,356,065
<p>If you know the maximum lengths of data in the two columns, then you can use format qualifiers. For example if the name is at most 20 chars long and the price will fit into 10 chars, you could do</p> <pre><code>print "Name: %-20s Price: %10d" % (i.name, i.price) </code></pre> <p>This is better than using tabs as t...
16
2009-08-31T06:26:10Z
[ "python" ]
How do I line up text from python into columns in my terminal?
1,356,029
<p>I'm printing out some values from a script in my terminal window like this:</p> <pre><code>for i in items: print "Name: %s Price: %d" % (i.name, i.price) </code></pre> <p>How do I make these line up into columns?</p>
7
2009-08-31T06:08:43Z
1,356,087
<p>As Vinay said, use string format specifiers.</p> <p>If you don't know the maximum lengths, you can find them by making an extra pass through the list:</p> <pre><code>maxn, maxp = 0, 0 for item in items: maxn = max(maxn, len(item.name)) maxp = max(maxp, len(str(item.price))) </code></pre> <p>then use <code...
8
2009-08-31T06:34:58Z
[ "python" ]
How do I line up text from python into columns in my terminal?
1,356,029
<p>I'm printing out some values from a script in my terminal window like this:</p> <pre><code>for i in items: print "Name: %s Price: %d" % (i.name, i.price) </code></pre> <p>How do I make these line up into columns?</p>
7
2009-08-31T06:08:43Z
1,357,409
<p>You can also use the rjust() / ljust() methods for str objects.</p>
0
2009-08-31T13:13:08Z
[ "python" ]
file system performance testing
1,356,240
<p>I am writing a python script that will perform performance test in linux file system. so besides deadlocks, race conditions and time takes to perform an action (delete, read, write and create) what other variables/parameters should the test contain?</p>
1
2009-08-31T07:29:21Z
1,356,704
<p>Can you be a little more clear?</p> <p>I tried doing such once before using Python itself. I need time to try it out myself. I tried using time.time() to get the time since epoch. I think the time difference can suffice for file operations.</p> <p><strong>Update:</strong> Check this GSOC Idea, PSF had pledged to s...
0
2009-08-31T09:46:19Z
[ "python", "filesystems", "performance-testing" ]
file system performance testing
1,356,240
<p>I am writing a python script that will perform performance test in linux file system. so besides deadlocks, race conditions and time takes to perform an action (delete, read, write and create) what other variables/parameters should the test contain?</p>
1
2009-08-31T07:29:21Z
1,356,966
<p>You might be inetersting in looking at tools like caollectd and iotop. Then again, yopu mightalso by interested in just using them instead of reinventing the wheel - as far as I see, such performance analysis is not learned in a day, and these guys invested significant amounts of time and knowledge in building thes...
0
2009-08-31T11:15:39Z
[ "python", "filesystems", "performance-testing" ]
file system performance testing
1,356,240
<p>I am writing a python script that will perform performance test in linux file system. so besides deadlocks, race conditions and time takes to perform an action (delete, read, write and create) what other variables/parameters should the test contain?</p>
1
2009-08-31T07:29:21Z
1,356,981
<p>You should try to use the softwares already present. You can use iozone for the same. For tutorial, you should refer to <a href="http://www.cyberciti.biz/tips/linux-filesystem-benchmarking-with-iozone.html" rel="nofollow">this blog post on nixcraft</a></p>
0
2009-08-31T11:19:22Z
[ "python", "filesystems", "performance-testing" ]
file system performance testing
1,356,240
<p>I am writing a python script that will perform performance test in linux file system. so besides deadlocks, race conditions and time takes to perform an action (delete, read, write and create) what other variables/parameters should the test contain?</p>
1
2009-08-31T07:29:21Z
1,356,986
<p>File system performance testing is a very complex topic. You can easily make a lots of mistakes that basically make your whole tests worthless.</p> <p>Stony Brook University and IBM Watson Labs have published an highly recommended journal paper in the "Transaction of Storage" about file system benchmarking, in whic...
3
2009-08-31T11:20:46Z
[ "python", "filesystems", "performance-testing" ]
Display jpg images in python
1,356,255
<p>I am creating a simple tool to add album cover images to mp3 files in python. So far I am just working on sending a request to amazon with artist and album title, and get the resulting list, as well as finding the actual images for each result. What I want to do is to display a simple frame with a button/link for ea...
5
2009-08-31T07:32:00Z
1,356,598
<p>you can modify <a href="http://www.daniweb.com/code/snippet622.html" rel="nofollow">this</a> using <code>urllib.urlopen()</code>. But I don't know (as I haven't tested it) if you can make this step without saving the (image) file locally. But IMHO <code>urlopen</code> returns a file handle that is usable in <code>tk...
3
2009-08-31T09:16:07Z
[ "python", "tkinter" ]
Display jpg images in python
1,356,255
<p>I am creating a simple tool to add album cover images to mp3 files in python. So far I am just working on sending a request to amazon with artist and album title, and get the resulting list, as well as finding the actual images for each result. What I want to do is to display a simple frame with a button/link for ea...
5
2009-08-31T07:32:00Z
1,356,882
<p>For displaying jpgs in Python check out PIL </p>
0
2009-08-31T10:49:02Z
[ "python", "tkinter" ]
sum of two numbers coming from the command line
1,356,348
<p>I know it's a very basic program but I am getting an error of list out of range. Here is the program to take two numbers as command-line arguments (while invoking the script) and display sum (using python):</p> <pre><code>import sys a= sys.argv[1] b= sys.argv[2] sum=str( a+b) print " sum is", sum </code></pre>
2
2009-08-31T08:03:31Z
1,356,353
<pre><code>su = int(a) + int(b) print("sum is %d" % su) </code></pre> <p>And you should be careful with your variable naming. <code>sum</code> shadows the built-in, it's not a good practice to do that (that is, don't name variables as built-in functions or any globally defined name).</p>
0
2009-08-31T08:06:53Z
[ "python" ]
sum of two numbers coming from the command line
1,356,348
<p>I know it's a very basic program but I am getting an error of list out of range. Here is the program to take two numbers as command-line arguments (while invoking the script) and display sum (using python):</p> <pre><code>import sys a= sys.argv[1] b= sys.argv[2] sum=str( a+b) print " sum is", sum </code></pre>
2
2009-08-31T08:03:31Z
1,356,354
<p>You should do this:</p> <pre><code>import sys a, b = sys.argv[1:2] summ = int(a) + int(b) print "sum is", summ </code></pre> <p>There is no need for str() when printing an integer. But you should use int() if you want to add a and b as integers.</p>
5
2009-08-31T08:07:03Z
[ "python" ]
sum of two numbers coming from the command line
1,356,348
<p>I know it's a very basic program but I am getting an error of list out of range. Here is the program to take two numbers as command-line arguments (while invoking the script) and display sum (using python):</p> <pre><code>import sys a= sys.argv[1] b= sys.argv[2] sum=str( a+b) print " sum is", sum </code></pre>
2
2009-08-31T08:03:31Z
1,356,373
<p>The error <code>list index out of range</code> means that you are trying to access a list item that is outside the bounds of the list.</p> <p>Example:</p> <pre><code>&gt;&gt;&gt; mylist = ['hello', 'world'] &gt;&gt;&gt; print mylist[2] Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;modul...
3
2009-08-31T08:12:03Z
[ "python" ]
sum of two numbers coming from the command line
1,356,348
<p>I know it's a very basic program but I am getting an error of list out of range. Here is the program to take two numbers as command-line arguments (while invoking the script) and display sum (using python):</p> <pre><code>import sys a= sys.argv[1] b= sys.argv[2] sum=str( a+b) print " sum is", sum </code></pre>
2
2009-08-31T08:03:31Z
1,356,380
<p>If your error is <em>"list index out of range"</em>, then the problem is that your <em>list</em> doesn't have enough items. Which list? The only list you're using is <strong><code>sys.argv</code></strong>, so to populate it, you need to pass more items on the command line.</p> <p>Alternatively, check for the lengt...
0
2009-08-31T08:12:26Z
[ "python" ]
sum of two numbers coming from the command line
1,356,348
<p>I know it's a very basic program but I am getting an error of list out of range. Here is the program to take two numbers as command-line arguments (while invoking the script) and display sum (using python):</p> <pre><code>import sys a= sys.argv[1] b= sys.argv[2] sum=str( a+b) print " sum is", sum </code></pre>
2
2009-08-31T08:03:31Z
1,356,388
<p>Assuming your inputs are integers:</p> <pre><code>import sys summ = sum(map(int,sys.argv[1:]) print "sum is ", summ </code></pre> <p>or</p> <pre><code>import sys summ = sum(int(i) for i in sys.argv[1:]) print "sum is ", summ </code></pre> <p>If not, change int to float.</p> <p>The second method is probably more...
3
2009-08-31T08:15:30Z
[ "python" ]
sum of two numbers coming from the command line
1,356,348
<p>I know it's a very basic program but I am getting an error of list out of range. Here is the program to take two numbers as command-line arguments (while invoking the script) and display sum (using python):</p> <pre><code>import sys a= sys.argv[1] b= sys.argv[2] sum=str( a+b) print " sum is", sum </code></pre>
2
2009-08-31T08:03:31Z
1,356,835
<p>If you wish to sum the numbers as floating points number use "float" instead of "int", like in the following snippet.</p> <pre><code>import sys try: a, b = sys.argv[1:3] print "sum is ", float(a) + float(b) except ValueError: print "please give me two numbers to sum" </code></pre> <p>Beware that floating ...
0
2009-08-31T10:31:14Z
[ "python" ]
sum of two numbers coming from the command line
1,356,348
<p>I know it's a very basic program but I am getting an error of list out of range. Here is the program to take two numbers as command-line arguments (while invoking the script) and display sum (using python):</p> <pre><code>import sys a= sys.argv[1] b= sys.argv[2] sum=str( a+b) print " sum is", sum </code></pre>
2
2009-08-31T08:03:31Z
1,761,045
<p>Thanks to every one. I got the answer</p> <p>for i in range (1,51): if i%5==0: print i,"\n" else: print i,</p>
0
2009-11-19T05:19:32Z
[ "python" ]
Detecting case mismatch on filename in Windows (preferably using python)?
1,356,386
<p>I have some xml-configuration files that we create in a Windows environment but is deployed on Linux. These configuration files reference each other with filepaths. We've had problems with case-sensitivity and trailing spaces before, and I'd like to write a script that checks for these problems. We have Cygwin if th...
4
2009-08-31T08:13:44Z
1,356,777
<p>it's hard to judge what exactly your problem is, but if you apply <a href="http://docs.python.org/library/os.path.html#os.path.normcase" rel="nofollow"><code>os.path.normcase</code></a> along with <a href="http://docs.python.org/library/stdtypes.html#str.strip" rel="nofollow"><code>str.stript</code></a> before savin...
0
2009-08-31T10:12:25Z
[ "python", "windows", "case-sensitive" ]
Detecting case mismatch on filename in Windows (preferably using python)?
1,356,386
<p>I have some xml-configuration files that we create in a Windows environment but is deployed on Linux. These configuration files reference each other with filepaths. We've had problems with case-sensitivity and trailing spaces before, and I'd like to write a script that checks for these problems. We have Cygwin if th...
4
2009-08-31T08:13:44Z
1,357,817
<p><a href="http://docs.python.org/library/os.html#os.listdir" rel="nofollow">os.listdir</a> on a directory, in all case-preserving filesystems (including those on Windows), returns the actual case for the filenames in the directory you're listing.</p> <p>So you need to do this check at each level of the path:</p> <p...
3
2009-08-31T14:45:10Z
[ "python", "windows", "case-sensitive" ]
How to Extract the key from unnecessary Html Wrapping in python
1,356,705
<p>The HTML page containing the key and some \n character .I need to use only key block i.e from -----BEGIN PGP PUBLIC KEY BLOCK----- to -----END PGP PUBLIC KEY BLOCK----- and after putting extracting key in a file can i pass it in any function.... </p>
1
2009-08-31T09:46:29Z
1,356,737
<p>in it's simpliest form</p> <pre><code>import re clean = re.sub("&lt;/?[^\W].{0,10}?&gt;|\n|\r\n", "", your_html) #remove tags and newlines key = re.search(r'BEGIN PGP PUBLIC KEY BLOCK.+?END PGP PUBLIC KEY BLOCK', clean) </code></pre> <p>or if you don't need <code>BEGIN PGP ... BLOCK</code> and <code>END PGP ... B...
0
2009-08-31T09:57:49Z
[ "python" ]
Django : save a new value in a ManyToManyField
1,356,761
<p>I gave details on my code : I don't know why my table is empty (it seems that it was empty out after calling <code>save_model</code>, but I'm not sure).</p> <pre><code>class PostAdmin(admin.ModelAdmin): def save_model(self, request, post, form, change): post.save() # Authors must be saved after...
0
2009-08-31T10:06:54Z
1,356,863
<p>You need to save the post again, after the post.authors.add(authors). </p>
2
2009-08-31T10:43:53Z
[ "python", "django", "save", "add", "manytomanyfield" ]
Django : save a new value in a ManyToManyField
1,356,761
<p>I gave details on my code : I don't know why my table is empty (it seems that it was empty out after calling <code>save_model</code>, but I'm not sure).</p> <pre><code>class PostAdmin(admin.ModelAdmin): def save_model(self, request, post, form, change): post.save() # Authors must be saved after...
0
2009-08-31T10:06:54Z
1,357,836
<p>I don't know what kind of field you're using, but shouldn't there be one of these in there somewhere? (or something similar)</p> <pre><code>author = form.cleaned_data['authors'] User.objects.get(id=author) </code></pre>
0
2009-08-31T14:48:46Z
[ "python", "django", "save", "add", "manytomanyfield" ]
Django : save a new value in a ManyToManyField
1,356,761
<p>I gave details on my code : I don't know why my table is empty (it seems that it was empty out after calling <code>save_model</code>, but I'm not sure).</p> <pre><code>class PostAdmin(admin.ModelAdmin): def save_model(self, request, post, form, change): post.save() # Authors must be saved after...
0
2009-08-31T10:06:54Z
1,362,907
<p>I found the solution. I've just changed the value in cleaned_data and it works :</p> <pre><code>if not form.cleaned_data['authors']: form.cleaned_data['authors'] = [request.user] </code></pre> <p>Thank for helping me. :)</p>
1
2009-09-01T14:51:30Z
[ "python", "django", "save", "add", "manytomanyfield" ]
Can I write a screencapture in Python
1,357,564
<ul> <li>Are there any libraries to that can be used to write a screen capture in Python.</li> <li>Can it be made to be cross-platform?</li> <li>Is it possible to capture to video? And if could that be in real-time?</li> <li>Or would it be possible to directly generate flash movies?</li> </ul>
15
2009-08-31T13:51:29Z
1,357,573
<p>I don't know of any general purpose libraries. I did this for windows and used some <a href="http://www.google.com/search?rlz=1C1CHMB%5FenUS325US325&amp;sourceid=chrome&amp;ie=UTF-8&amp;q=codeproject.com+screen+capture" rel="nofollow">codeproject.com</a> code in a DLL, called from ctypes.</p> <p>Video capture is p...
2
2009-08-31T13:53:13Z
[ "python", "flash" ]
Can I write a screencapture in Python
1,357,564
<ul> <li>Are there any libraries to that can be used to write a screen capture in Python.</li> <li>Can it be made to be cross-platform?</li> <li>Is it possible to capture to video? And if could that be in real-time?</li> <li>Or would it be possible to directly generate flash movies?</li> </ul>
15
2009-08-31T13:51:29Z
1,357,898
<p>screen capture can be done with <a href="http://www.pythonware.com/library/pil/handbook/imagegrab.htm" rel="nofollow">PIL thanks to the ImageGrab module</a></p> <p>For generating Flash movies, you can have a look at <a href="http://www.libming.net/FrontPage" rel="nofollow">ming</a>. I am not sure that it has this c...
3
2009-08-31T15:02:06Z
[ "python", "flash" ]
Can I write a screencapture in Python
1,357,564
<ul> <li>Are there any libraries to that can be used to write a screen capture in Python.</li> <li>Can it be made to be cross-platform?</li> <li>Is it possible to capture to video? And if could that be in real-time?</li> <li>Or would it be possible to directly generate flash movies?</li> </ul>
15
2009-08-31T13:51:29Z
1,358,093
<p>One way to capture a video of the user's screen (certainly for X11, not sure about Windows) is to use gstreamer with the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-ximagesrc.html" rel="nofollow">ximagesrc plugin</a>. There are Python bindi...
1
2009-08-31T15:51:17Z
[ "python", "flash" ]
Can I write a screencapture in Python
1,357,564
<ul> <li>Are there any libraries to that can be used to write a screen capture in Python.</li> <li>Can it be made to be cross-platform?</li> <li>Is it possible to capture to video? And if could that be in real-time?</li> <li>Or would it be possible to directly generate flash movies?</li> </ul>
15
2009-08-31T13:51:29Z
1,523,752
<p>you can try this also may be this <a href="http://pypi.python.org/pypi/castro/1.0.4" rel="nofollow">URL</a> can help you out.</p> <p>its castro !!! see the sample code below may be useful....</p> <pre><code>&gt;&gt;&gt; from castro import Castro &gt;&gt;&gt; c = Castro() &gt;&gt;&gt; c.start() &gt;&gt;&gt; # Do s...
3
2009-10-06T05:29:27Z
[ "python", "flash" ]
Can I write a screencapture in Python
1,357,564
<ul> <li>Are there any libraries to that can be used to write a screen capture in Python.</li> <li>Can it be made to be cross-platform?</li> <li>Is it possible to capture to video? And if could that be in real-time?</li> <li>Or would it be possible to directly generate flash movies?</li> </ul>
15
2009-08-31T13:51:29Z
6,247,532
<p>I've written a cross-platform screen capture tool in wxPython. See download "GeneralScreenShotWX.py" in subtopic "A Flexible Screen Capture App" under topic "WorkingWithImages" @ <a href="http://wiki.wxpython.org/WorkingWithImages#A_Flexible_Screen_Capture_App" rel="nofollow">http://wiki.wxpython.org/WorkingWithIm...
2
2011-06-06T03:28:44Z
[ "python", "flash" ]
Can I write a screencapture in Python
1,357,564
<ul> <li>Are there any libraries to that can be used to write a screen capture in Python.</li> <li>Can it be made to be cross-platform?</li> <li>Is it possible to capture to video? And if could that be in real-time?</li> <li>Or would it be possible to directly generate flash movies?</li> </ul>
15
2009-08-31T13:51:29Z
10,727,134
<p>I guess all possible ways to take Python controlled screenshots are covered at <a href="https://github.com/ponty/pyscreenshot" rel="nofollow">https://github.com/ponty/pyscreenshot</a></p>
0
2012-05-23T20:12:21Z
[ "python", "flash" ]
pytz utc conversion
1,357,711
<p>What is the right way to convert a naive time and a <code>tzinfo</code> into an utc time? Say I have:</p> <pre><code>d = datetime(2009, 8, 31, 22, 30, 30) tz = timezone('US/Pacific') </code></pre> <p>First way, pytz inspired:</p> <pre><code>d_tz = tz.normalize(tz.localize(d)) utc = pytz.timezone('UTC') d_utc = d_...
20
2009-08-31T14:22:55Z
1,357,965
<p>Use the first method. There's no reason to reinvent the wheel of timezone conversion </p>
0
2009-08-31T15:18:22Z
[ "python", "datetime", "utc", "pytz" ]
pytz utc conversion
1,357,711
<p>What is the right way to convert a naive time and a <code>tzinfo</code> into an utc time? Say I have:</p> <pre><code>d = datetime(2009, 8, 31, 22, 30, 30) tz = timezone('US/Pacific') </code></pre> <p>First way, pytz inspired:</p> <pre><code>d_tz = tz.normalize(tz.localize(d)) utc = pytz.timezone('UTC') d_utc = d_...
20
2009-08-31T14:22:55Z
1,358,161
<p>Your first method seems to be the approved one, and should be DST-aware.</p> <p>You could shorten it a tiny bit, since <em>pytz.utc = pytz.timezone('UTC')</em>, but you knew that already :)</p> <pre><code>tz = timezone('US/Pacific') def toUTC(d): return tz.normalize(tz.localize(d)).astimezone(pytz.utc) print ...
18
2009-08-31T16:07:40Z
[ "python", "datetime", "utc", "pytz" ]
pytz utc conversion
1,357,711
<p>What is the right way to convert a naive time and a <code>tzinfo</code> into an utc time? Say I have:</p> <pre><code>d = datetime(2009, 8, 31, 22, 30, 30) tz = timezone('US/Pacific') </code></pre> <p>First way, pytz inspired:</p> <pre><code>d_tz = tz.normalize(tz.localize(d)) utc = pytz.timezone('UTC') d_utc = d_...
20
2009-08-31T14:22:55Z
26,190,657
<blockquote> <p>What is the right way to convert a naive time and a tzinfo into an utc time? </p> </blockquote> <p><a href="http://stackoverflow.com/a/26163706/4279">This answer enumerates some issues with converting a local time to UTC</a>:</p> <pre><code>from datetime import datetime import pytz # $ pip install p...
2
2014-10-04T07:25:02Z
[ "python", "datetime", "utc", "pytz" ]
pytz utc conversion
1,357,711
<p>What is the right way to convert a naive time and a <code>tzinfo</code> into an utc time? Say I have:</p> <pre><code>d = datetime(2009, 8, 31, 22, 30, 30) tz = timezone('US/Pacific') </code></pre> <p>First way, pytz inspired:</p> <pre><code>d_tz = tz.normalize(tz.localize(d)) utc = pytz.timezone('UTC') d_utc = d_...
20
2009-08-31T14:22:55Z
31,574,271
<pre><code> import pytz from django.utils import timezone tz = pytz.timezone('America/Los_Angeles') time = tz.normalize(timezone.now()) </code></pre>
-2
2015-07-22T21:25:59Z
[ "python", "datetime", "utc", "pytz" ]
Finding set difference between two complex dictionaries
1,358,101
<p>I have two dictionaries of the following structure: </p> <pre><code>a) dict1 = {'a':[ [1,2], [3,4] ], 'b':[ [1,2],[5,6] ]} b) dict2 = {'a':[ [1,2], [5,6] ], 'b':[ [1,2],[7,8] ]} </code></pre> <p>I need to find the set difference between each key in the dictionary i.e., dict1['a'] - dict2['a'] should return [3,4]. ...
2
2009-08-31T15:53:23Z
1,358,150
<p>The use of mutable items (such as lists) makes the problem MUCH harder, as it precludes the simple use of Python's <code>set</code> data structure. It may be worth making temporary copies/versions which actually use tuples in lieu of those pesky lists:</p> <pre><code>def tempaux(d): return dict((k, set(tuple(x) f...
6
2009-08-31T16:04:57Z
[ "python-3.x", "python" ]
Finding set difference between two complex dictionaries
1,358,101
<p>I have two dictionaries of the following structure: </p> <pre><code>a) dict1 = {'a':[ [1,2], [3,4] ], 'b':[ [1,2],[5,6] ]} b) dict2 = {'a':[ [1,2], [5,6] ], 'b':[ [1,2],[7,8] ]} </code></pre> <p>I need to find the set difference between each key in the dictionary i.e., dict1['a'] - dict2['a'] should return [3,4]. ...
2
2009-08-31T15:53:23Z
1,358,156
<pre><code>&gt;&gt;&gt; s1 = set([(1,2), (3,4)]) &gt;&gt;&gt; s2 = set([(1,2), (5,6)]) &gt;&gt;&gt; s1 - s2 {(3, 4)} </code></pre>
3
2009-08-31T16:06:56Z
[ "python-3.x", "python" ]
Finding set difference between two complex dictionaries
1,358,101
<p>I have two dictionaries of the following structure: </p> <pre><code>a) dict1 = {'a':[ [1,2], [3,4] ], 'b':[ [1,2],[5,6] ]} b) dict2 = {'a':[ [1,2], [5,6] ], 'b':[ [1,2],[7,8] ]} </code></pre> <p>I need to find the set difference between each key in the dictionary i.e., dict1['a'] - dict2['a'] should return [3,4]. ...
2
2009-08-31T15:53:23Z
1,358,787
<p>You've got the wrong data structure for what you're trying to do.</p> <p>Use this instead.</p> <pre><code>dict1 = {'a': [(1, 2), (3, 4)], 'b': [(1, 2), (5, 6)]} dict2 = {'a': [(1, 2), (5, 6)], 'b': [(1, 2), (7, 8)]} </code></pre> <p>Life is simpler when you try to do set operations on immutable objects like tuple...
2
2009-08-31T18:36:32Z
[ "python-3.x", "python" ]
Finding set difference between two complex dictionaries
1,358,101
<p>I have two dictionaries of the following structure: </p> <pre><code>a) dict1 = {'a':[ [1,2], [3,4] ], 'b':[ [1,2],[5,6] ]} b) dict2 = {'a':[ [1,2], [5,6] ], 'b':[ [1,2],[7,8] ]} </code></pre> <p>I need to find the set difference between each key in the dictionary i.e., dict1['a'] - dict2['a'] should return [3,4]. ...
2
2009-08-31T15:53:23Z
12,791,351
<h1>applicable to list or dict or number when a and b share the same structure</h1> <pre><code>c={'a':'1','b':'2'} d={'a':'10','b':'20'} e={'x':c,'t':15} f={'x':d,'t':19} def diff(a,b): if isinstance(a, int) and isinstance(b, int): b = b - a return b if isinstance(a, str) and isinstance(b, str...
2
2012-10-09T00:37:11Z
[ "python-3.x", "python" ]
Creating database schema for parsed feed
1,358,501
<p>Additional questions regarding <a href="http://stackoverflow.com/questions/1354415/split-twitter-rss-string-using-python">SilentGhost's initial answer</a> to a problem I'm having parsing Twitter RSS feeds. See also partial code below.</p> <p>First, could I insert <code>tags[0]</code>, <code>tags[1]</code>, etc., in...
0
2009-08-31T17:37:18Z
1,358,551
<p>I would suggest reading up on <a href="http://en.wikipedia.org/wiki/Database%5Fnormalization" rel="nofollow">database normalisation</a>, especially on 1st and 2nd normal forms. Once you're done with it, I hope there won't be need for default values, and your db schema evolves into something more appropriate.</p> <p...
2
2009-08-31T17:44:24Z
[ "python", "rss", "database-schema" ]
Raising an exception on updating a 'constant' attribute in python
1,358,711
<p>As python does not have concept of constants, would it be possible to raise an exception if an 'constant' attribute is updated? How? </p> <pre><code>class MyClass(): CLASS_CONSTANT = 'This is a constant' var = 'This is a not a constant, can be updated' #this should raise an exception MyClass.CLASS_CON...
2
2009-08-31T18:21:13Z
1,358,752
<p>If you really want to have constant that can't be changed then look at this: <a href="http://code.activestate.com/recipes/65207/" rel="nofollow">http://code.activestate.com/recipes/65207/</a></p>
0
2009-08-31T18:28:10Z
[ "python", "exception", "attributes", "constants" ]
Raising an exception on updating a 'constant' attribute in python
1,358,711
<p>As python does not have concept of constants, would it be possible to raise an exception if an 'constant' attribute is updated? How? </p> <pre><code>class MyClass(): CLASS_CONSTANT = 'This is a constant' var = 'This is a not a constant, can be updated' #this should raise an exception MyClass.CLASS_CON...
2
2009-08-31T18:21:13Z
1,358,753
<p>Start reading this:</p> <p><a href="http://docs.python.org/reference/datamodel.html#customizing-attribute-access" rel="nofollow">http://docs.python.org/reference/datamodel.html#customizing-attribute-access</a></p> <p>You basically write your own version of <code>__setattr__</code> that throws exceptions for some a...
1
2009-08-31T18:28:18Z
[ "python", "exception", "attributes", "constants" ]
Raising an exception on updating a 'constant' attribute in python
1,358,711
<p>As python does not have concept of constants, would it be possible to raise an exception if an 'constant' attribute is updated? How? </p> <pre><code>class MyClass(): CLASS_CONSTANT = 'This is a constant' var = 'This is a not a constant, can be updated' #this should raise an exception MyClass.CLASS_CON...
2
2009-08-31T18:21:13Z
1,358,755
<p>You could do something like this: (from <a href="http://www.siafoo.net/snippet/108" rel="nofollow">http://www.siafoo.net/snippet/108</a>)</p> <pre><code>class Constants: # A constant variable foo = 1337 def __setattr__(self, attr, value): if hasattr(self, attr): raise ValueError, 'Attribute %s alre...
2
2009-08-31T18:28:40Z
[ "python", "exception", "attributes", "constants" ]
Raising an exception on updating a 'constant' attribute in python
1,358,711
<p>As python does not have concept of constants, would it be possible to raise an exception if an 'constant' attribute is updated? How? </p> <pre><code>class MyClass(): CLASS_CONSTANT = 'This is a constant' var = 'This is a not a constant, can be updated' #this should raise an exception MyClass.CLASS_CON...
2
2009-08-31T18:21:13Z
1,358,832
<p>Customizing <code>__setattr__</code> in every class (e.g. as exemplified in my old recipe that @ainab's answer is pointing to, and other answers), only works to stop assignment to INSTANCE attributes and not to CLASS attributes. So, none of the existing answers would actually satisfy your requirement as stated.</p>...
3
2009-08-31T18:46:22Z
[ "python", "exception", "attributes", "constants" ]
Raising an exception on updating a 'constant' attribute in python
1,358,711
<p>As python does not have concept of constants, would it be possible to raise an exception if an 'constant' attribute is updated? How? </p> <pre><code>class MyClass(): CLASS_CONSTANT = 'This is a constant' var = 'This is a not a constant, can be updated' #this should raise an exception MyClass.CLASS_CON...
2
2009-08-31T18:21:13Z
1,358,863
<p>You can use a metaclass to achieve this:</p> <pre><code>class ImmutableConstants(type): def __init__(cls, name, bases, dct): type.__init__(cls, name, bases, dct) old_setattr = cls.__setattr__ def __setattr__(self, key, value): cls.assert_attribute_mutable(key) ol...
2
2009-08-31T18:53:43Z
[ "python", "exception", "attributes", "constants" ]
How to make several plots on a single page using matplotlib?
1,358,977
<p>I have written code that opens 16 figures at once. Currently they all open as separate graphs. I'd like them to open all on the same page. Not the same graph. I want 16 separate graphs on a single page/window. Also for some reason the format of the numbins and defaultreallimits doesn't hold past figure 1. Do I ...
48
2009-08-31T19:17:03Z
1,358,983
<p>To answer your main question, you want to use the <a href="http://matplotlib.sourceforge.net/api/pyplot%5Fapi.html#matplotlib.pyplot.subplot">subplot</a> command. I think changing <code>plt.figure(i)</code> to <code>plt.subplot(4,4,i+1)</code> should work.</p>
10
2009-08-31T19:19:17Z
[ "python", "numpy", "matplotlib" ]
How to make several plots on a single page using matplotlib?
1,358,977
<p>I have written code that opens 16 figures at once. Currently they all open as separate graphs. I'd like them to open all on the same page. Not the same graph. I want 16 separate graphs on a single page/window. Also for some reason the format of the numbins and defaultreallimits doesn't hold past figure 1. Do I ...
48
2009-08-31T19:17:03Z
2,060,170
<p>The answer from <em>las3rjock</em>, which somehow is the answer accepted by the OP, is incorrect--the code doesn't run, nor is it valid matplotlib syntax; that answer provides no runnable code and lacks any information or suggestion that the OP might find useful in writing their own code to solve the problem in the ...
109
2010-01-13T20:52:22Z
[ "python", "numpy", "matplotlib" ]
How to make several plots on a single page using matplotlib?
1,358,977
<p>I have written code that opens 16 figures at once. Currently they all open as separate graphs. I'd like them to open all on the same page. Not the same graph. I want 16 separate graphs on a single page/window. Also for some reason the format of the numbins and defaultreallimits doesn't hold past figure 1. Do I ...
48
2009-08-31T19:17:03Z
2,064,911
<p>This works also:</p> <pre><code>for i in range(19): plt.subplot(5,4,i+1) </code></pre> <p>It plots 19 total graphs on one page. The format is 5 down and 4 across..</p>
6
2010-01-14T14:51:37Z
[ "python", "numpy", "matplotlib" ]
How to make several plots on a single page using matplotlib?
1,358,977
<p>I have written code that opens 16 figures at once. Currently they all open as separate graphs. I'd like them to open all on the same page. Not the same graph. I want 16 separate graphs on a single page/window. Also for some reason the format of the numbins and defaultreallimits doesn't hold past figure 1. Do I ...
48
2009-08-31T19:17:03Z
18,673,184
<p>Since this question is from 4 years ago new things have been implemented and among them there is a <a href="http://matplotlib.org/api/pyplot_api.html">new function <code>plt.subplots</code> which is very convenient</a>:</p> <pre><code>fig, axes = plot.subplots(nrows=2, ncols=3, sharex=True, sharey=True) </code></pr...
43
2013-09-07T12:14:45Z
[ "python", "numpy", "matplotlib" ]
Wildcard Downloads with Python
1,359,090
<p>How can I download files from a website using wildacrds in Python? I have a site that I need to download file from periodically. The problem is the filenames change each time. A portion of the file stays the same though. How can I use a wildcard to specify the unknown portion of the file in a URL?</p>
1
2009-08-31T19:46:12Z
1,359,101
<p>If the filename changes, there must still be a <em>link</em> to the file somewhere (otherwise nobody would ever guess the filename). A typical approach is to get the HTML page that contains a link to the file, search through that looking for the link target, and then send a second request to get the actual file you'...
7
2009-08-31T19:48:53Z
[ "python" ]
Wildcard Downloads with Python
1,359,090
<p>How can I download files from a website using wildacrds in Python? I have a site that I need to download file from periodically. The problem is the filenames change each time. A portion of the file stays the same though. How can I use a wildcard to specify the unknown portion of the file in a URL?</p>
1
2009-08-31T19:46:12Z
1,359,226
<p>You could try logging into the ftp server using <a href="http://python.org/doc/2.5.2/lib/module-ftplib.html" rel="nofollow">ftplib</a>. From the python docs:</p> <pre><code>from ftplib import FTP ftp = FTP('ftp.cwi.nl') # connect to host, default port ftp.login() # user anonymous, passwd anonymous@ ...
1
2009-08-31T20:18:42Z
[ "python" ]
PyObjc and Cocoa on Snow Leopard
1,359,227
<p>I am about to start my A-Level Computing project (High School Level) which will hopefully be a point-of-sale application for Mac OS. Unfortunately, Objective-C is a little out of my league at the moment and should I get stuck with it in the project I have no one to help out so I would fail the section of the course...
13
2009-08-31T20:19:29Z
1,359,402
<p>You mean like <a href="http://checkoutapp.com/" rel="nofollow">Checkout</a>? :-) I only mention it because Checkout is gorgeous and written with PyObjC...</p> <p>Your concerns are valid, although probably not as much of a potential showstopper as you'd think. Using PyObjC still requires you to learn some Objective-...
7
2009-08-31T21:00:03Z
[ "python", "cocoa", "xcode", "osx-snow-leopard", "pyobjc" ]
PyObjc and Cocoa on Snow Leopard
1,359,227
<p>I am about to start my A-Level Computing project (High School Level) which will hopefully be a point-of-sale application for Mac OS. Unfortunately, Objective-C is a little out of my league at the moment and should I get stuck with it in the project I have no one to help out so I would fail the section of the course...
13
2009-08-31T20:19:29Z
1,359,428
<p>I hardly use PyObjC myself, but I believe you need to run the Xcode installer on the Snow Leopard DVD in order to use PyObjC.</p> <p>Also, as Quinn said, you will need to understand at least some Objective-C in order to use a Cocoa bridge like PyObjC without tearing your hair out. It just doesn't insulate you that ...
3
2009-08-31T21:06:29Z
[ "python", "cocoa", "xcode", "osx-snow-leopard", "pyobjc" ]
PyObjc and Cocoa on Snow Leopard
1,359,227
<p>I am about to start my A-Level Computing project (High School Level) which will hopefully be a point-of-sale application for Mac OS. Unfortunately, Objective-C is a little out of my league at the moment and should I get stuck with it in the project I have no one to help out so I would fail the section of the course...
13
2009-08-31T20:19:29Z
1,359,557
<p>I'm going to agree with Quinn here. Even if you're already proficient in Python, learning how to interface Python and Cocoa is not going to be any easier than learning Cocoa with Objective-C.</p> <p>Objective-C is a simple, clean language that is quite easy to grok. Building the GUI and hooking it up to the back-e...
3
2009-08-31T21:41:34Z
[ "python", "cocoa", "xcode", "osx-snow-leopard", "pyobjc" ]
PyObjc and Cocoa on Snow Leopard
1,359,227
<p>I am about to start my A-Level Computing project (High School Level) which will hopefully be a point-of-sale application for Mac OS. Unfortunately, Objective-C is a little out of my league at the moment and should I get stuck with it in the project I have no one to help out so I would fail the section of the course...
13
2009-08-31T20:19:29Z
1,359,575
<p>And as one of the Checkout developers I'll weigh in too (hi Quinn!). From what we've seen PyObjC runs fairly well on Snow Leopard. We've built one of the latest SVN revisions 2.2b with some customizations on Leopard and just moved over the site-packages folder.</p> <p>Theoretically you should be able to use the bui...
4
2009-08-31T21:48:38Z
[ "python", "cocoa", "xcode", "osx-snow-leopard", "pyobjc" ]
PyObjc and Cocoa on Snow Leopard
1,359,227
<p>I am about to start my A-Level Computing project (High School Level) which will hopefully be a point-of-sale application for Mac OS. Unfortunately, Objective-C is a little out of my league at the moment and should I get stuck with it in the project I have no one to help out so I would fail the section of the course...
13
2009-08-31T20:19:29Z
1,359,605
<p>Allow me to echo what has already been said. I too am a student who just started a Cocoa development project, and at the beginning I thought "Well, I already know Python, I'll just use PyObjC and save myself from having to learn Objective-C, which looks beyond my grasp." I learned quickly that it can't be done. You ...
19
2009-08-31T22:00:20Z
[ "python", "cocoa", "xcode", "osx-snow-leopard", "pyobjc" ]
PyObjc and Cocoa on Snow Leopard
1,359,227
<p>I am about to start my A-Level Computing project (High School Level) which will hopefully be a point-of-sale application for Mac OS. Unfortunately, Objective-C is a little out of my league at the moment and should I get stuck with it in the project I have no one to help out so I would fail the section of the course...
13
2009-08-31T20:19:29Z
1,905,283
<p>I'm a long time python developer who's been doing iPhone apps for awhile now (and only using my python knowledge to package up build files for the apps in run scripts), then who started making some PyObjC apps.</p> <p>I'd have to say, PyObjC is pretty much STILL having to learn objective C (which I already know via...
3
2009-12-15T05:06:45Z
[ "python", "cocoa", "xcode", "osx-snow-leopard", "pyobjc" ]
Generate two lists at once
1,359,232
<p><strong>Background</strong></p> <p>The algorithm manipulates financial analytics. There are multiple lists of the same size and they are filtered into other lists for analysis. I am doing the same filtering on different by parallel lists. I could set it up so that a1,b1,c2 occur as a tuple in a list but then the an...
2
2009-08-31T20:21:02Z
1,359,256
<p>There's no way to create multiple lists at a time with list comprehensions--if you only want to iterate once you're going to need to do it some other way--possible with a loop.</p> <p>You <em>could</em> use a list comprehension to create a list of tuples, with the first element belonging to one list, the second to ...
0
2009-08-31T20:28:32Z
[ "python" ]
Generate two lists at once
1,359,232
<p><strong>Background</strong></p> <p>The algorithm manipulates financial analytics. There are multiple lists of the same size and they are filtered into other lists for analysis. I am doing the same filtering on different by parallel lists. I could set it up so that a1,b1,c2 occur as a tuple in a list but then the an...
2
2009-08-31T20:21:02Z
1,359,274
<p>Just use a <code>for</code> loop:</p> <pre><code>aprime = [] bprime = [] for a1, b1, c1 in zip(a, b, c): if c1 == 0: aprime.append(a1) bprime.append(b1) </code></pre>
4
2009-08-31T20:32:00Z
[ "python" ]
Generate two lists at once
1,359,232
<p><strong>Background</strong></p> <p>The algorithm manipulates financial analytics. There are multiple lists of the same size and they are filtered into other lists for analysis. I am doing the same filtering on different by parallel lists. I could set it up so that a1,b1,c2 occur as a tuple in a list but then the an...
2
2009-08-31T20:21:02Z
1,359,279
<p>This might win the ugliest code award, but it works in one line:</p> <pre><code>aprime, bprime = zip(*[(a1,b1) for a1,b1,c1 in zip(a,b,c) if c1==0]) </code></pre>
3
2009-08-31T20:33:29Z
[ "python" ]
Python: Run a process and kill it if it doesn't end within one hour
1,359,383
<p>I need to do the following in Python. I want to spawn a process (subprocess module?), and:</p> <ul> <li>if the process ends normally, to continue exactly from the moment it terminates;</li> <li>if, otherwise, the process "gets stuck" and doesn't terminate within (say) one hour, to kill it and continue (possibly giv...
10
2009-08-31T20:55:29Z
1,359,467
<p>The <code>subprocess</code> module will be your friend. Start the process to get a <code>Popen</code> object, then pass it to a function like this. Note that this only raises exception on timeout. If desired you can catch the exception and call the <code>kill()</code> method on the <code>Popen</code> process. (kill ...
16
2009-08-31T21:17:10Z
[ "python", "process", "kill" ]
Python: Run a process and kill it if it doesn't end within one hour
1,359,383
<p>I need to do the following in Python. I want to spawn a process (subprocess module?), and:</p> <ul> <li>if the process ends normally, to continue exactly from the moment it terminates;</li> <li>if, otherwise, the process "gets stuck" and doesn't terminate within (say) one hour, to kill it and continue (possibly giv...
10
2009-08-31T20:55:29Z
10,539,952
<p>There are at least 2 ways to do this by using <a href="http://code.google.com/p/psutil/" rel="nofollow">psutil</a> as long as you know the process PID. Assuming the process is created as such:</p> <pre><code>import subprocess subp = subprocess.Popen(['progname']) </code></pre> <p>...you can get its creation time i...
5
2012-05-10T18:19:37Z
[ "python", "process", "kill" ]
django : ImportError No module named myapp.views.hometest
1,359,449
<p>I have fecora 11, set django with mod_wsgi2.5 and apache2.2. And I can run "python manage.py runserver" at local. It works fine. I got error when i test from remote browser. </p> <p>Thanks for any suggestion and help!</p>
3
2009-08-31T21:10:12Z
1,359,482
<p>Is the application containing your Django project in your <code>$PYTHONPATH</code> (when Python is invoked in a server context)? For example, if your Django project is at <code>/home/wwwuser/web/myproj</code>, then <code>/home/wwwuser/web</code> should be in your <code>$PYTHONPATH</code>. You should set this in the ...
2
2009-08-31T21:21:35Z
[ "python", "django", "mod-wsgi" ]
django : ImportError No module named myapp.views.hometest
1,359,449
<p>I have fecora 11, set django with mod_wsgi2.5 and apache2.2. And I can run "python manage.py runserver" at local. It works fine. I got error when i test from remote browser. </p> <p>Thanks for any suggestion and help!</p>
3
2009-08-31T21:10:12Z
1,359,494
<p>Just a guess, but unless you've explicitly made sure that your app is on PYTHONPATH, you should be specifying views in urls.py as myproject.myapp.views.functionname.</p> <p>Otherwise:</p> <ul> <li>check if you're setting PYTHONPATH, or what to. Your project directory should be in there.</li> <li>if you enable the ...
1
2009-08-31T21:23:51Z
[ "python", "django", "mod-wsgi" ]
django : ImportError No module named myapp.views.hometest
1,359,449
<p>I have fecora 11, set django with mod_wsgi2.5 and apache2.2. And I can run "python manage.py runserver" at local. It works fine. I got error when i test from remote browser. </p> <p>Thanks for any suggestion and help!</p>
3
2009-08-31T21:10:12Z
1,360,370
<ul> <li>All required env variables should be set in django.wsgi. You could compare the env declared in django.wsgi and the env of executing <code>./manage runserver</code> and make sure they are same.</li> <li>Furthermore, if there is another myapp package which could be found through PYTHONPATH before <code>/usr/loca...
1
2009-09-01T03:21:18Z
[ "python", "django", "mod-wsgi" ]
django : ImportError No module named myapp.views.hometest
1,359,449
<p>I have fecora 11, set django with mod_wsgi2.5 and apache2.2. And I can run "python manage.py runserver" at local. It works fine. I got error when i test from remote browser. </p> <p>Thanks for any suggestion and help!</p>
3
2009-08-31T21:10:12Z
2,978,457
<p>I just had this problem. It went away when I added <code>sys.path.append('/path/to/project')</code> to my .wsgi file.</p>
4
2010-06-04T23:47:42Z
[ "python", "django", "mod-wsgi" ]
Error while using multiprocessing module in a python daemon
1,359,795
<p>I'm getting the following error when using the <strong>multiprocessing</strong> module within a python daemon process (using <strong>python-daemon</strong>):</p> <pre> Traceback (most recent call last): File "/usr/local/lib/python2.6/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) File "/usr/lo...
5
2009-08-31T23:02:05Z
1,360,108
<p>I think there was a fix put into trunk and 2.6 maint a little while ago which should help with this can you try running your script in python-trunk or the latest 2.6-maint svn? I'm failing to pull up the bug information</p>
0
2009-09-01T01:01:06Z
[ "python", "daemon", "multiprocessing" ]
Error while using multiprocessing module in a python daemon
1,359,795
<p>I'm getting the following error when using the <strong>multiprocessing</strong> module within a python daemon process (using <strong>python-daemon</strong>):</p> <pre> Traceback (most recent call last): File "/usr/local/lib/python2.6/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) File "/usr/lo...
5
2009-08-31T23:02:05Z
1,360,375
<p>Looks like your error is coming at the very end of your process -- your clue's at the very start of your traceback, and I quote...:</p> <pre><code>File "/usr/local/lib/python2.6/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) </code></pre> <p>if <code>atexit._run_exitfuncs</code> is running, this ...
0
2009-09-01T03:24:06Z
[ "python", "daemon", "multiprocessing" ]
Error while using multiprocessing module in a python daemon
1,359,795
<p>I'm getting the following error when using the <strong>multiprocessing</strong> module within a python daemon process (using <strong>python-daemon</strong>):</p> <pre> Traceback (most recent call last): File "/usr/local/lib/python2.6/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) File "/usr/lo...
5
2009-08-31T23:02:05Z
1,419,952
<p>I'm running into this also using the celery distributed task manager under RHEL 5.3 with Python 2.6. My traceback looks a little different but the error the same:</p> <pre><code> File "/usr/local/lib/python2.6/multiprocessing/pool.py", line 334, in terminate self._terminate() File "/usr/local/lib/python...
0
2009-09-14T06:25:02Z
[ "python", "daemon", "multiprocessing" ]
Error while using multiprocessing module in a python daemon
1,359,795
<p>I'm getting the following error when using the <strong>multiprocessing</strong> module within a python daemon process (using <strong>python-daemon</strong>):</p> <pre> Traceback (most recent call last): File "/usr/local/lib/python2.6/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) File "/usr/lo...
5
2009-08-31T23:02:05Z
1,423,690
<p>The original sample script has "import signal" but no use of signals. However, I had a script causing this error message and it was due to my signal handling, so I'll explain here in case its what is happening for others. Within a signal handler, I was doing stuff with processes (e.g. creating a new process). App...
0
2009-09-14T20:20:25Z
[ "python", "daemon", "multiprocessing" ]
Error while using multiprocessing module in a python daemon
1,359,795
<p>I'm getting the following error when using the <strong>multiprocessing</strong> module within a python daemon process (using <strong>python-daemon</strong>):</p> <pre> Traceback (most recent call last): File "/usr/local/lib/python2.6/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) File "/usr/lo...
5
2009-08-31T23:02:05Z
1,431,666
<p>Your problem is a conflict between the daemon and multiprocessing modules, in particular in its handling of the SIGCLD (child process terminated) signal. daemon sets SIGCLD to SIG_IGN when launching, which, at least on Linux, causes terminated children to immediately be reaped (rather than becoming a zombie until th...
5
2009-09-16T08:24:54Z
[ "python", "daemon", "multiprocessing" ]
Error while using multiprocessing module in a python daemon
1,359,795
<p>I'm getting the following error when using the <strong>multiprocessing</strong> module within a python daemon process (using <strong>python-daemon</strong>):</p> <pre> Traceback (most recent call last): File "/usr/local/lib/python2.6/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) File "/usr/lo...
5
2009-08-31T23:02:05Z
1,439,684
<p>Ignoring <code>SIGCLD</code> also causes problems with the <code>subprocess</code> module, because of a bug in that module (<a href="http://bugs.python.org/issue1731717" rel="nofollow">issue 1731717</a>, still open as of 2011-09-21).</p> <p>This behaviour is addressed in <a href="http://pypi.python.org/pypi/python-...
4
2009-09-17T15:45:43Z
[ "python", "daemon", "multiprocessing" ]
Killing the background window when running a .exe from a Python program
1,360,066
<p>the following is a line from a python program that calls the "demo.exe" file. a window for demo.exe opens when it is called, is there any way for demo.exe to run in the "background"? that is, i don't want the window for it show, i just want demo.exe to run.</p> <p><pre><code> p = subprocess.Popen(args = "demo.exe",...
2
2009-09-01T00:42:08Z
1,360,088
<p>Try this:</p> <pre><code>from subprocess import Popen, PIPE, STARTUPINFO, STARTF_USESHOWWINDOW startupinfo = STARTUPINFO() startupinfo.dwFlags |= STARTF_USESHOWWINDOW p = Popen(cmdlist, startupinfo=startupinfo, ...) </code></pre>
3
2009-09-01T00:51:40Z
[ "python", "executable" ]
Killing the background window when running a .exe from a Python program
1,360,066
<p>the following is a line from a python program that calls the "demo.exe" file. a window for demo.exe opens when it is called, is there any way for demo.exe to run in the "background"? that is, i don't want the window for it show, i just want demo.exe to run.</p> <p><pre><code> p = subprocess.Popen(args = "demo.exe",...
2
2009-09-01T00:42:08Z
1,360,102
<p>Thanks to <a href="http://stackoverflow.com/questions/1016384/cross-platform-subprocess-with-hidden-window">another StackOverflow thread</a>, I think this is what you need:</p> <pre><code>startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW p = subprocess.Popen(args = "demo....
4
2009-09-01T00:58:43Z
[ "python", "executable" ]
Generating a list from complex dictionary
1,360,507
<p>I have a dictionary <code>dict1['a'] = [ [1,2], [3,4] ]</code> and need to generate a list out of it as <code>l1 = [2, 4]</code>. That is, a list out of the second element of each inner list. It can be a separate list or even the dictionary can be modified as <code>dict1['a'] = [2,4]</code>.</p>
2
2009-09-01T04:17:35Z
1,360,514
<p>Given a list:</p> <pre><code>&gt;&gt;&gt; lst = [ [1,2], [3,4] ] </code></pre> <p>You can extract the second element of each sublist with a simple list comprehension:</p> <pre><code>&gt;&gt;&gt; [x[1] for x in lst] [2, 4] </code></pre> <p>If you want to do this for every value in a dictionary, you can iterate ov...
8
2009-09-01T04:22:45Z
[ "python-3.x", "python" ]
Generating a list from complex dictionary
1,360,507
<p>I have a dictionary <code>dict1['a'] = [ [1,2], [3,4] ]</code> and need to generate a list out of it as <code>l1 = [2, 4]</code>. That is, a list out of the second element of each inner list. It can be a separate list or even the dictionary can be modified as <code>dict1['a'] = [2,4]</code>.</p>
2
2009-09-01T04:17:35Z
1,360,566
<blockquote> <p>a list out of the second element of each inner list</p> </blockquote> <p>that sounds like <code>[sl[1] for sl in dict1['a']]</code> -- so what's the QUESTION?!-)</p>
0
2009-09-01T04:46:58Z
[ "python-3.x", "python" ]
Generating a list from complex dictionary
1,360,507
<p>I have a dictionary <code>dict1['a'] = [ [1,2], [3,4] ]</code> and need to generate a list out of it as <code>l1 = [2, 4]</code>. That is, a list out of the second element of each inner list. It can be a separate list or even the dictionary can be modified as <code>dict1['a'] = [2,4]</code>.</p>
2
2009-09-01T04:17:35Z
1,360,674
<p>Assuming that each value in the dictionary is a list of pairs, then this should do it for you:</p> <pre><code>[pair[1] for pairlist in dict1.values() for pair in pairlist] </code></pre> <p>As you can see:</p> <ul> <li><code>dict1.values()</code> gets you just the values in your dict,</li> <li><code>for pairlist i...
2
2009-09-01T05:28:48Z
[ "python-3.x", "python" ]
How to get/set local variables of a function (from outside) in Python?
1,360,721
<p>If I have a function (in Python 2.5.2) like:</p> <pre><code>def sample_func(): a = 78 b = range(5) #c = a + b[2] - x </code></pre> <p>My questions are:</p> <ol> <li>How to get the local variables (a,b) of the function from outside <strong>without</strong> using <em>locals()</em> inside the function? (...
3
2009-09-01T05:50:41Z
1,360,732
<p>I'm not sure what your use-case is, but this may work better as a class. You can define the <code>__call__</code> method to make a class behave like a function.</p> <p>e.g.:</p> <pre><code>&gt;&gt;&gt; class sample_func(object): ... def __init__(self): ... self.a = 78 ... self.b = range(5) ......
6
2009-09-01T05:54:15Z
[ "python" ]
How to get/set local variables of a function (from outside) in Python?
1,360,721
<p>If I have a function (in Python 2.5.2) like:</p> <pre><code>def sample_func(): a = 78 b = range(5) #c = a + b[2] - x </code></pre> <p>My questions are:</p> <ol> <li>How to get the local variables (a,b) of the function from outside <strong>without</strong> using <em>locals()</em> inside the function? (...
3
2009-09-01T05:50:41Z
1,360,794
<p>The function's locals change whenever the function is run, so there's little meaning to access them while the function isn't running.</p>
1
2009-09-01T06:16:10Z
[ "python" ]
How to get/set local variables of a function (from outside) in Python?
1,360,721
<p>If I have a function (in Python 2.5.2) like:</p> <pre><code>def sample_func(): a = 78 b = range(5) #c = a + b[2] - x </code></pre> <p>My questions are:</p> <ol> <li>How to get the local variables (a,b) of the function from outside <strong>without</strong> using <em>locals()</em> inside the function? (...
3
2009-09-01T05:50:41Z
1,361,058
<p>No. A function that isn't being run doesn't have locals; it's just a function. Asking how to modify a function's locals when it's not running is like asking how to modify a program's heap when it's not running.</p> <p>You can modify constants, though, if you really want to.</p> <pre><code>def func(): a = 10 ...
12
2009-09-01T07:34:41Z
[ "python" ]
How to get/set local variables of a function (from outside) in Python?
1,360,721
<p>If I have a function (in Python 2.5.2) like:</p> <pre><code>def sample_func(): a = 78 b = range(5) #c = a + b[2] - x </code></pre> <p>My questions are:</p> <ol> <li>How to get the local variables (a,b) of the function from outside <strong>without</strong> using <em>locals()</em> inside the function? (...
3
2009-09-01T05:50:41Z
1,364,790
<p>Not sure if this is what you mean, but as functions are objects in Python you can bind variables to a function object and access them from 'outside':</p> <pre><code>def fa(): print 'x value of fa() when entering fa(): %s' % fa.x print 'y value of fb() when entering fa(): %s' % fb.y fa.x += fb.y prin...
1
2009-09-01T21:44:02Z
[ "python" ]
How to get/set local variables of a function (from outside) in Python?
1,360,721
<p>If I have a function (in Python 2.5.2) like:</p> <pre><code>def sample_func(): a = 78 b = range(5) #c = a + b[2] - x </code></pre> <p>My questions are:</p> <ol> <li>How to get the local variables (a,b) of the function from outside <strong>without</strong> using <em>locals()</em> inside the function? (...
3
2009-09-01T05:50:41Z
1,375,287
<p>Expecting a variable in a function to be set by an outside function BEFORE that function is called is such bad design that the only real answer I can recommend is changing the design. A function that expects its internal variables to be set before it is run is useless.</p> <p>So the real question you have to ask is...
1
2009-09-03T18:57:56Z
[ "python" ]
stop python object going out of scope in c++
1,361,028
<p>Is there a way to transfer a new class instance (python class that inherits c++ class) into c++ with out having to hold on to the object return and just treat it as a c++ pointer.</p> <p>For example:</p> <p>C++</p> <pre><code>object pyInstance = GetLocalDict()["makeNewGamePlay"](); CGEPYGameMode* m_pGameMode = ex...
0
2009-09-01T07:28:21Z
1,361,575
<p>You must increment the <a href="http://docs.python.org/extending/extending.html#reference-counting-in-python" rel="nofollow">reference count</a> of the pyInstance. That will prevent Python from deleting it. When you are ready to delete it, you can simply decrement the reference count and Python will clean it up for ...
2
2009-09-01T09:53:45Z
[ "c++", "python", "boost", "object" ]
KeyboardInterrupt in Windows?
1,361,217
<p>How to generate a KeyboardInterrupt in Windows? </p> <pre><code>while True: try: print 'running' except KeyboardInterrupt: break </code></pre> <p>I expected <kbd>CTRL+C</kbd> to stop this program but it doesn't work.</p>
0
2009-09-01T08:22:24Z
1,361,524
<p>Your code is working ok when ran into a windows console.</p> <p>Ctrl+C generating a KeyboardInterrupt is a console feature. If you run it from a text editor like SciTE, it will not work.</p>
2
2009-09-01T09:39:59Z
[ "python", "windows", "keyboardinterrupt" ]
import csv file into mysql database using django web application
1,361,357
<p>thanks guys.i managed to complete it.million thanks again specially for DAVID,WM-EDDIE and S.LOTT.also STACKOVERFLOW</p> <p>The solution:</p> <pre><code> **model = Contact() model.contact_owner = request.user model.contact_name = row[1] model.contact_m...
2
2009-09-01T09:00:16Z
1,361,418
<p>To tokenize a comma separated string:</p> <pre><code>&gt;&gt;&gt; a = 'abubakar,rooney,0178222123,student abubakar,rooneyzzz,0178222164' &gt;&gt;&gt; b = a.split(',') &gt;&gt;&gt; print b ['abubakar', 'rooney', '0178222123', 'student abubakar', 'rooneyzzz', '0178222164'] </code></pre> <p>See @wm_eddie's answer for...
0
2009-09-01T09:13:54Z
[ "python", "django" ]
import csv file into mysql database using django web application
1,361,357
<p>thanks guys.i managed to complete it.million thanks again specially for DAVID,WM-EDDIE and S.LOTT.also STACKOVERFLOW</p> <p>The solution:</p> <pre><code> **model = Contact() model.contact_owner = request.user model.contact_name = row[1] model.contact_m...
2
2009-09-01T09:00:16Z
1,361,462
<p>Python's manuals are pretty bad. You are "supposed" to infer that because they use the string.join() that row works like an list. So pretty much it parses the CSV file into a list of lists. It takes care of all the nasty quoting, and escaping for you.</p> <p>You use it just like you would use an array/list</p> <...
0
2009-09-01T09:25:02Z
[ "python", "django" ]
import csv file into mysql database using django web application
1,361,357
<p>thanks guys.i managed to complete it.million thanks again specially for DAVID,WM-EDDIE and S.LOTT.also STACKOVERFLOW</p> <p>The solution:</p> <pre><code> **model = Contact() model.contact_owner = request.user model.contact_name = row[1] model.contact_m...
2
2009-09-01T09:00:16Z
1,361,676
<p>This is approximately what we do.</p> <pre><code>header = 'contact_owner', 'contact_name', 'contact_mobile_number', 'select_group' rdr= csv.reader(request.FILES['file']) for row in rdr: data = zip( header, row ) owner, created = User.get_or_create( data['contact_owner'] data['contact_owner']= owner ...
0
2009-09-01T10:19:11Z
[ "python", "django" ]
Match multiple patterns in a multiline string
1,361,373
<p>I have some data which look like that:</p> <pre><code>PMID- 19587274 OWN - NLM DP - 2009 Jul 8 TI - Domain general mechanisms of perceptual decision making in human cortex. PG - 8675-87 AB - To successfully interact with objects in the environment, sensory evidence must be continuously acquired, interpret...
0
2009-09-01T09:04:21Z
1,361,422
<p>How about:</p> <pre><code>import re reg4 = re.compile(r'^(?:PMID- (?P&lt;pmid&gt;[0-9]+)|TI - (?P&lt;title&gt;.*?)^PG|AB - (?P&lt;abstract&gt;.*?)^AD)', re.MULTILINE | re.DOTALL) for i in reg4.finditer(data): print i.groupdict() </code></pre> <p>Output:</p> <pre><code>{'pmid': '19587274', 'abstract': None, ...
2
2009-09-01T09:14:15Z
[ "python", "regex" ]
Match multiple patterns in a multiline string
1,361,373
<p>I have some data which look like that:</p> <pre><code>PMID- 19587274 OWN - NLM DP - 2009 Jul 8 TI - Domain general mechanisms of perceptual decision making in human cortex. PG - 8675-87 AB - To successfully interact with objects in the environment, sensory evidence must be continuously acquired, interpret...
0
2009-09-01T09:04:21Z
1,361,453
<p>The problem were the greedy qualifiers. Here's a regex that is more specific, and non-greedy:</p> <pre><code>#!/usr/bin/python import re from pprint import pprint data = open("testdata.txt").read() reg4 = r''' ^PMID # Start matching at the string PMID \s*?- # As little whitespace ...
0
2009-09-01T09:22:03Z
[ "python", "regex" ]
Match multiple patterns in a multiline string
1,361,373
<p>I have some data which look like that:</p> <pre><code>PMID- 19587274 OWN - NLM DP - 2009 Jul 8 TI - Domain general mechanisms of perceptual decision making in human cortex. PG - 8675-87 AB - To successfully interact with objects in the environment, sensory evidence must be continuously acquired, interpret...
0
2009-09-01T09:04:21Z
1,361,497
<p>Another regex:</p> <pre><code>reg4 = r'(?&lt;=PMID- )(?P&lt;pmid&gt;.*?)(?=OWN - ).*?(?&lt;=TI - )(?P&lt;title&gt;.*?)(?=PG - ).*?(?&lt;=AB - )(?P&lt;abstract&gt;.*?)(?=AD - )' </code></pre>
0
2009-09-01T09:33:01Z
[ "python", "regex" ]
Match multiple patterns in a multiline string
1,361,373
<p>I have some data which look like that:</p> <pre><code>PMID- 19587274 OWN - NLM DP - 2009 Jul 8 TI - Domain general mechanisms of perceptual decision making in human cortex. PG - 8675-87 AB - To successfully interact with objects in the environment, sensory evidence must be continuously acquired, interpret...
0
2009-09-01T09:04:21Z
1,361,611
<p>How about not using regexps for this task, but instead using programmatic code that splits by newlines, looks at prefix codes using .startswith() etc? The code would be longer that way but everyone would be able to understand it, without having to come to stackoverflow for help.</p>
2
2009-09-01T10:02:20Z
[ "python", "regex" ]
Match multiple patterns in a multiline string
1,361,373
<p>I have some data which look like that:</p> <pre><code>PMID- 19587274 OWN - NLM DP - 2009 Jul 8 TI - Domain general mechanisms of perceptual decision making in human cortex. PG - 8675-87 AB - To successfully interact with objects in the environment, sensory evidence must be continuously acquired, interpret...
0
2009-09-01T09:04:21Z
1,361,692
<p>If the order of the lines can change, you could use this pattern:</p> <pre><code>reg4 = re.compile(r""" ^ (?: PMID \s*-\s* (?P&lt;pmid&gt; [0-9]+ ) \n | TI \s*-\s* (?P&lt;title&gt; .* (?:\n[^\S\n].*)* ) \n | AB \s*-\s* (?P&lt;abstract&gt; .* (?:\n[^\S\n].*)* ) \n | .+\n )+ """, re...
0
2009-09-01T10:23:10Z
[ "python", "regex" ]