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 list |
|---|---|---|---|---|---|---|---|---|---|
Message Box in Python | 257,398 | <p>Is there a UI library to create a message box or input box in python?</p>
| 6 | 2008-11-02T21:22:30Z | 257,853 | <p>Simple message boxes and input boxes can be created using EasyGui, a small library using Tkinter, which Python comes with.</p>
<p>You can get EasyGui here: <a href="http://easygui.sourceforge.net/" rel="nofollow">http://easygui.sourceforge.net/</a></p>
| 3 | 2008-11-03T03:16:40Z | [
"python",
"user-controls",
"user-interface"
] |
Message Box in Python | 257,398 | <p>Is there a UI library to create a message box or input box in python?</p>
| 6 | 2008-11-02T21:22:30Z | 8,678,916 | <p>from Tkinter </p>
<pre><code>import *
import os
class Dialog(Toplevel):
def __init__(self, parent, title = None):
Toplevel.__init__(self, parent)
self.transient(parent)
if title:
self.title(title)
self.parent = parent
self.result = None
body... | 1 | 2011-12-30T11:21:03Z | [
"python",
"user-controls",
"user-interface"
] |
Download image file from the HTML page source using python? | 257,409 | <p>I am writing a scraper that downloads all the image files from a HTML page and saves them to a specific folder. all the images are the part of the HTML page.</p>
| 33 | 2008-11-02T21:31:00Z | 257,412 | <p>You have to download the page and parse html document, find your image with regex and download it.. You can use urllib2 for downloading and Beautiful Soup for parsing html file.</p>
| 8 | 2008-11-02T21:33:53Z | [
"python",
"screen-scraping"
] |
Download image file from the HTML page source using python? | 257,409 | <p>I am writing a scraper that downloads all the image files from a HTML page and saves them to a specific folder. all the images are the part of the HTML page.</p>
| 33 | 2008-11-02T21:31:00Z | 257,413 | <p>Use htmllib to extract all img tags (override do_img), then use urllib2 to download all the images.</p>
| 2 | 2008-11-02T21:34:28Z | [
"python",
"screen-scraping"
] |
Download image file from the HTML page source using python? | 257,409 | <p>I am writing a scraper that downloads all the image files from a HTML page and saves them to a specific folder. all the images are the part of the HTML page.</p>
| 33 | 2008-11-02T21:31:00Z | 258,511 | <p>Here is some code to download all the images from the supplied URL, and save them in the specified output folder. You can modify it to your own needs.</p>
<pre><code>"""
dumpimages.py
Downloads all the images on the supplied URL, and saves them to the
specified output file ("/test/" by default)
Usage:
... | 69 | 2008-11-03T12:40:27Z | [
"python",
"screen-scraping"
] |
Download image file from the HTML page source using python? | 257,409 | <p>I am writing a scraper that downloads all the image files from a HTML page and saves them to a specific folder. all the images are the part of the HTML page.</p>
| 33 | 2008-11-02T21:31:00Z | 2,448,326 | <p>And this is function for download one image:</p>
<pre><code>def download_photo(self, img_url, filename):
file_path = "%s%s" % (DOWNLOADED_IMAGE_PATH, filename)
downloaded_image = file(file_path, "wb")
image_on_web = urllib.urlopen(img_url)
while True:
buf = image_on_web.read(65536)
... | 8 | 2010-03-15T15:35:20Z | [
"python",
"screen-scraping"
] |
Download image file from the HTML page source using python? | 257,409 | <p>I am writing a scraper that downloads all the image files from a HTML page and saves them to a specific folder. all the images are the part of the HTML page.</p>
| 33 | 2008-11-02T21:31:00Z | 4,200,547 | <p>Ryan's solution is good, but fails if the image source URLs are absolute URLs or anything that doesn't give a good result when simply concatenated to the main page URL. urljoin recognizes absolute vs. relative URLs, so replace the loop in the middle with:</p>
<pre><code>for image in soup.findAll("img"):
print ... | 9 | 2010-11-17T00:49:24Z | [
"python",
"screen-scraping"
] |
Download image file from the HTML page source using python? | 257,409 | <p>I am writing a scraper that downloads all the image files from a HTML page and saves them to a specific folder. all the images are the part of the HTML page.</p>
| 33 | 2008-11-02T21:31:00Z | 24,837,891 | <p>If the request need an authorization refer to this one:</p>
<pre><code>r_img = requests.get(img_url, auth=(username, password))
f = open('000000.jpg','wb')
f.write(r_img.content)
f.close()
</code></pre>
| 1 | 2014-07-19T07:29:33Z | [
"python",
"screen-scraping"
] |
What's the difference between scgi and wsgi? | 257,481 | <p>What's the difference between these two?
Which is better/faster/reliable?</p>
| 10 | 2008-11-02T22:22:25Z | 257,511 | <p>They are both specifications for plugging a web application into a web server. One glaring difference is that WSGI comes from the Python world, and I believe there are no non-python implementations.</p>
<p><strong>Specifications are generally not comparable based on better/faster/reliable.</strong> </p>
<p>Only th... | 7 | 2008-11-02T22:39:23Z | [
"python",
"wsgi",
"scgi"
] |
What's the difference between scgi and wsgi? | 257,481 | <p>What's the difference between these two?
Which is better/faster/reliable?</p>
| 10 | 2008-11-02T22:22:25Z | 257,642 | <p>SCGI is a language-neutral means of connecting a front-end web server and a web application. WSGI is a Python-specific interface standard for web applications.</p>
<p>Though they both have roots in CGI, they're rather different in scope and you could indeed quite reasonably use both at once, for example having a mo... | 21 | 2008-11-03T00:28:52Z | [
"python",
"wsgi",
"scgi"
] |
What's the difference between scgi and wsgi? | 257,481 | <p>What's the difference between these two?
Which is better/faster/reliable?</p>
| 10 | 2008-11-02T22:22:25Z | 778,530 | <p>SCGI (like FastCGI) is a (serialized) protocol suitable for inter-process communication between a web-server and a web-application.</p>
<p>WSGI is a Python API, connecting two (or more) Python WSGI-compatible modules inside the same process (Python interpreter). One module represents the web-server (being either a ... | 6 | 2009-04-22T18:21:54Z | [
"python",
"wsgi",
"scgi"
] |
Python MySQL Statement returning Error | 257,563 | <p>hey, I'm very new to all this so please excuse stupidity :)</p>
<pre><code>import os
import MySQLdb
import time
db = MySQLdb.connect(host="localhost", user="root", passwd="********", db="workspace")
cursor = db.cursor()
tailoutputfile = os.popen('tail -f syslog.log')
while 1:
x = tailoutputfile.readline()... | 2 | 2008-11-02T23:26:35Z | 257,570 | <pre><code> cursor.execute("INSERT INTO releases (date, cat, name) values (timestring, y[4], y[7]")
</code></pre>
<p>should be</p>
<pre><code> cursor.execute("INSERT INTO releases (date, cat, name) values (timestring, '%s', '%s')" % (y[4], y[7]))
</code></pre>
<p>Your best bet to debug things like this is to put the... | 4 | 2008-11-02T23:29:44Z | [
"python",
"sql"
] |
Python MySQL Statement returning Error | 257,563 | <p>hey, I'm very new to all this so please excuse stupidity :)</p>
<pre><code>import os
import MySQLdb
import time
db = MySQLdb.connect(host="localhost", user="root", passwd="********", db="workspace")
cursor = db.cursor()
tailoutputfile = os.popen('tail -f syslog.log')
while 1:
x = tailoutputfile.readline()... | 2 | 2008-11-02T23:26:35Z | 257,614 | <p>As pointed out, you're failing to copy the Python variable values into the query, only their names, which mean nothing to MySQL.</p>
<p>However the direct string concatenation option:</p>
<pre><code>cursor.execute("INSERT INTO releases (date, cat, name) VALUES ('%s', '%s', '%s')" % (timestring, y[4], y[7]))
</code... | 9 | 2008-11-03T00:02:17Z | [
"python",
"sql"
] |
Python MySQL Statement returning Error | 257,563 | <p>hey, I'm very new to all this so please excuse stupidity :)</p>
<pre><code>import os
import MySQLdb
import time
db = MySQLdb.connect(host="localhost", user="root", passwd="********", db="workspace")
cursor = db.cursor()
tailoutputfile = os.popen('tail -f syslog.log')
while 1:
x = tailoutputfile.readline()... | 2 | 2008-11-02T23:26:35Z | 298,414 | <p>never use "direct string concatenation" with SQL, because it's not secure, more correct variant:</p>
<pre><code>cursor.execute('INSERT INTO releases (date, cat, name) VALUES (%s, %s, %s)', (timestring, y[4], y[7]))
</code></pre>
<p>it automatically escaping forbidden symbols in values (such as ", ' etc)</p>
| 1 | 2008-11-18T10:46:53Z | [
"python",
"sql"
] |
'Snippit' based django semi-CMS | 257,655 | <p>I remember reading somewhere on the internets about a half-assed tiny django CMS app, which was basically built on 'snippets' of text.</p>
<p>The idea was, that in the admin, you make a snippet (say a description of a product), give it a name (such as 'google_desc') and call it in a template with something like {% ... | 0 | 2008-11-03T00:42:46Z | 257,695 | <p>Are you talking about <a href="http://www.punteney.com/writes/django-simplepages-basic-page-cms-system/" rel="nofollow">Django Simplepages</a>? Official site <a href="http://code.google.com/p/django-simplepages/" rel="nofollow">here</a>.</p>
<p>Another project that sounds similar to what you're after is <a href="h... | 1 | 2008-11-03T01:09:02Z | [
"python",
"django",
"content-management-system"
] |
'Snippit' based django semi-CMS | 257,655 | <p>I remember reading somewhere on the internets about a half-assed tiny django CMS app, which was basically built on 'snippets' of text.</p>
<p>The idea was, that in the admin, you make a snippet (say a description of a product), give it a name (such as 'google_desc') and call it in a template with something like {% ... | 0 | 2008-11-03T00:42:46Z | 258,282 | <p>Sounds like <a href="https://github.com/clintecker/django-chunks" rel="nofollow">django-chunks</a> to me.</p>
| 2 | 2008-11-03T10:25:56Z | [
"python",
"django",
"content-management-system"
] |
'Snippit' based django semi-CMS | 257,655 | <p>I remember reading somewhere on the internets about a half-assed tiny django CMS app, which was basically built on 'snippets' of text.</p>
<p>The idea was, that in the admin, you make a snippet (say a description of a product), give it a name (such as 'google_desc') and call it in a template with something like {% ... | 0 | 2008-11-03T00:42:46Z | 1,392,946 | <p>If you need some more features just checkout django-blocks (<a href="http://code.google.com/p/django-blocks/" rel="nofollow">http://code.google.com/p/django-blocks/</a>). Has multi-language Menu, Flatpages and even has a simple Shopping Cart!!</p>
| 1 | 2009-09-08T09:25:55Z | [
"python",
"django",
"content-management-system"
] |
How can I make a fake "active session" for gconf? | 257,658 | <p>I've automated my Ubuntu installation - I've got Python code that runs automatically (after a clean install, but before the first user login - it's in a temporary /etc/init.d/ script) that sets up everything from Apache & its configuration to my personal Gnome preferences. It's the latter that's giving me troubl... | 9 | 2008-11-03T00:45:10Z | 257,833 | <p>Well, I think I understand the question. Looks like your script just needs to start the dbus daemon, or make sure its started. I believe "session" here refers to a dbus session. <a href="http://mail.gnome.org/archives/svn-commits-list/2008-May/msg01997.html" rel="nofollow">(here is some evidence)</a>, not a Gnome se... | 1 | 2008-11-03T02:52:42Z | [
"python",
"ubuntu",
"gconf",
"intrepid"
] |
How can I make a fake "active session" for gconf? | 257,658 | <p>I've automated my Ubuntu installation - I've got Python code that runs automatically (after a clean install, but before the first user login - it's in a temporary /etc/init.d/ script) that sets up everything from Apache & its configuration to my personal Gnome preferences. It's the latter that's giving me troubl... | 9 | 2008-11-03T00:45:10Z | 260,731 | <p>I can reproduce this by installing GConf 2.24 on my machine. GConf 2.22 works fine, but 2.24 breaks it.</p>
<p>GConf is failing to launch because D-Bus is not running. Manually spawning D-Bus and the GConf daemon makes this work again.</p>
<p>I tried to spawn the D-Bus session bus by doing the following:</p>
<pre... | 8 | 2008-11-04T03:07:40Z | [
"python",
"ubuntu",
"gconf",
"intrepid"
] |
How can I make a fake "active session" for gconf? | 257,658 | <p>I've automated my Ubuntu installation - I've got Python code that runs automatically (after a clean install, but before the first user login - it's in a temporary /etc/init.d/ script) that sets up everything from Apache & its configuration to my personal Gnome preferences. It's the latter that's giving me troubl... | 9 | 2008-11-03T00:45:10Z | 261,180 | <p>Thanks, Ali & Jeremy - both your answers were a big help. I'm still working on this (though I've stopped for the evening).</p>
<p>First, I took the hint from Ali and was trying part of Jeremy's suggestion: I was using dbus-launch to run "gconftool-2 --spawn". It didn't work for me; I now understand why (thx, Je... | 1 | 2008-11-04T07:39:34Z | [
"python",
"ubuntu",
"gconf",
"intrepid"
] |
Java equivalent to pyftpdlib? | 257,956 | <p>Is there a good Java alternative to pyftpdlib? I am looking for an easy to setup and run embedded ftp server.</p>
| 1 | 2008-11-03T04:52:36Z | 257,973 | <p>Check out Apache's <a href="http://mina.apache.org/ftpserver/" rel="nofollow">FTPServer</a>.</p>
<p>They have an <a href="http://mina.apache.org/ftpserver/embedding-ftpserver-in-5-minutes.html" rel="nofollow">example</a> of how to embed it in a Java application.</p>
| 0 | 2008-11-03T05:11:20Z | [
"java",
"python",
"ftp"
] |
Python: wrapping method invocations with pre and post methods | 258,119 | <p>I am instantiating a class A (which I am importing from somebody
else, so I can't modify it) into my class X.</p>
<p>Is there a way I can intercept or wrape calls to methods in A?
I.e., in the code below can I call</p>
<pre><code>x.a.p1()
</code></pre>
<p>and get the output</p>
<pre><code>X.pre
A.p1
X.post
</cod... | 6 | 2008-11-03T08:23:10Z | 258,125 | <p>The no-whistles-or-bells solution would be to write a wrapper class for class A that does just that.</p>
| 1 | 2008-11-03T08:26:27Z | [
"python",
"metaprogramming"
] |
Python: wrapping method invocations with pre and post methods | 258,119 | <p>I am instantiating a class A (which I am importing from somebody
else, so I can't modify it) into my class X.</p>
<p>Is there a way I can intercept or wrape calls to methods in A?
I.e., in the code below can I call</p>
<pre><code>x.a.p1()
</code></pre>
<p>and get the output</p>
<pre><code>X.pre
A.p1
X.post
</cod... | 6 | 2008-11-03T08:23:10Z | 258,179 | <p>You could just modify the A instance and replace the p1 function with a wrapper function:</p>
<pre><code>def wrapped(pre, post, f):
def wrapper(*args, **kwargs):
pre()
retval = f(*args, **kwargs)
post()
return retval
return wrapper
class Y:
def __init__(self):
se... | 1 | 2008-11-03T09:06:35Z | [
"python",
"metaprogramming"
] |
Python: wrapping method invocations with pre and post methods | 258,119 | <p>I am instantiating a class A (which I am importing from somebody
else, so I can't modify it) into my class X.</p>
<p>Is there a way I can intercept or wrape calls to methods in A?
I.e., in the code below can I call</p>
<pre><code>x.a.p1()
</code></pre>
<p>and get the output</p>
<pre><code>X.pre
A.p1
X.post
</cod... | 6 | 2008-11-03T08:23:10Z | 258,253 | <p>I've just recently read about decorators in python, I'm not understanding them yet but it seems to me that they can be a solution to your problem. see Bruce Eckel intro to decorators at:
<a href="http://www.artima.com/weblogs/viewpost.jsp?thread=240808" rel="nofollow">http://www.artima.com/weblogs/viewpost.jsp?threa... | 1 | 2008-11-03T10:00:30Z | [
"python",
"metaprogramming"
] |
Python: wrapping method invocations with pre and post methods | 258,119 | <p>I am instantiating a class A (which I am importing from somebody
else, so I can't modify it) into my class X.</p>
<p>Is there a way I can intercept or wrape calls to methods in A?
I.e., in the code below can I call</p>
<pre><code>x.a.p1()
</code></pre>
<p>and get the output</p>
<pre><code>X.pre
A.p1
X.post
</cod... | 6 | 2008-11-03T08:23:10Z | 258,259 | <p>Here's what I've received from Steven D'Aprano on comp.lang.python.</p>
<pre><code># Define two decorator factories.
def precall(pre):
def decorator(f):
def newf(*args, **kwargs):
pre()
return f(*args, **kwargs)
return newf
return decorator
def postcall(post):
de... | 0 | 2008-11-03T10:07:25Z | [
"python",
"metaprogramming"
] |
Python: wrapping method invocations with pre and post methods | 258,119 | <p>I am instantiating a class A (which I am importing from somebody
else, so I can't modify it) into my class X.</p>
<p>Is there a way I can intercept or wrape calls to methods in A?
I.e., in the code below can I call</p>
<pre><code>x.a.p1()
</code></pre>
<p>and get the output</p>
<pre><code>X.pre
A.p1
X.post
</cod... | 6 | 2008-11-03T08:23:10Z | 258,274 | <p>Here is the solution I and my colleagues came up with:</p>
<pre><code>from types import MethodType
class PrePostCaller:
def __init__(self, other):
self.other = other
def pre(self): print 'pre'
def post(self): print 'post'
def __getattr__(self, name):
if hasattr(self.other, name):
... | 4 | 2008-11-03T10:18:21Z | [
"python",
"metaprogramming"
] |
Python: wrapping method invocations with pre and post methods | 258,119 | <p>I am instantiating a class A (which I am importing from somebody
else, so I can't modify it) into my class X.</p>
<p>Is there a way I can intercept or wrape calls to methods in A?
I.e., in the code below can I call</p>
<pre><code>x.a.p1()
</code></pre>
<p>and get the output</p>
<pre><code>X.pre
A.p1
X.post
</cod... | 6 | 2008-11-03T08:23:10Z | 258,283 | <p>As others have mentioned, the wrapper/decorator solution is probably be the easiest one. I don't recommend modifyng the wrapped class itself, for the same reasons that you point out.</p>
<p>If you have many external classes you can write a code generator to generate the wrapper classes for you. Since you are doing ... | 1 | 2008-11-03T10:27:04Z | [
"python",
"metaprogramming"
] |
Why are Exceptions iterable? | 258,228 | <p>I have been bitten by something unexpected recently. I wanted to make something like that:</p>
<pre><code>try :
thing.merge(iterable) # this is an iterable so I add it to the list
except TypeError :
thing.append(iterable) # this is not iterable, so I add it
</code></pre>
<p>Well, It was working fine unti... | 11 | 2008-11-03T09:46:03Z | 258,234 | <p>NOT VALID. Check Brian anwser.</p>
<p>Ok, I just got it :</p>
<pre><code>for x in Exception("test") :
print x
....:
....:
test
</code></pre>
<p>Don't bother ;-)</p>
<p>Anyway, it's good to know.</p>
<p>EDIT : looking to the comments, I feel like adding some explanations.</p>
<p>An exception... | 3 | 2008-11-03T09:47:35Z | [
"python",
"exception"
] |
Why are Exceptions iterable? | 258,228 | <p>I have been bitten by something unexpected recently. I wanted to make something like that:</p>
<pre><code>try :
thing.merge(iterable) # this is an iterable so I add it to the list
except TypeError :
thing.append(iterable) # this is not iterable, so I add it
</code></pre>
<p>Well, It was working fine unti... | 11 | 2008-11-03T09:46:03Z | 258,530 | <p>Actually, I still don't quite get it. I can see that iterating an Exception gives you the original args to the exception, I'm just not sure why anyone would want that. Implicit iteration is I think one of the few gotchas in Python that still trips me up.</p>
| 2 | 2008-11-03T12:48:33Z | [
"python",
"exception"
] |
Why are Exceptions iterable? | 258,228 | <p>I have been bitten by something unexpected recently. I wanted to make something like that:</p>
<pre><code>try :
thing.merge(iterable) # this is an iterable so I add it to the list
except TypeError :
thing.append(iterable) # this is not iterable, so I add it
</code></pre>
<p>Well, It was working fine unti... | 11 | 2008-11-03T09:46:03Z | 258,930 | <p>Note that what is happening is not related to any kind of implicit string conversion etc, but because the Exception class implements __getitem__(), and uses it to return the values in the args tuple (ex.args). You can see this by the fact that you get the whole string as your first and only item in the iteration, r... | 11 | 2008-11-03T15:08:02Z | [
"python",
"exception"
] |
Django models - how to filter number of ForeignKey objects | 258,296 | <p>I have a models <code>A</code> and <code>B</code>, that are like this:</p>
<pre><code>class A(models.Model):
title = models.CharField(max_length=20)
(...)
class B(models.Model):
date = models.DateTimeField(auto_now_add=True)
(...)
a = models.ForeignKey(A)
</code></pre>
<p>Now I have some <code>A</code> ... | 33 | 2008-11-03T10:38:54Z | 258,310 | <p>Sounds like a job for <a href="http://docs.djangoproject.com/en/dev/ref/models/querysets/#extra-select-none-where-none-params-none-tables-none-order-by-none-select-params-none"><code>extra</code></a>.</p>
<pre><code>A.objects.extra(
select={
'b_count': 'SELECT COUNT(*) FROM yourapp_b WHERE yourapp_b.a_i... | 6 | 2008-11-03T10:47:39Z | [
"python",
"django",
"database-design"
] |
Django models - how to filter number of ForeignKey objects | 258,296 | <p>I have a models <code>A</code> and <code>B</code>, that are like this:</p>
<pre><code>class A(models.Model):
title = models.CharField(max_length=20)
(...)
class B(models.Model):
date = models.DateTimeField(auto_now_add=True)
(...)
a = models.ForeignKey(A)
</code></pre>
<p>Now I have some <code>A</code> ... | 33 | 2008-11-03T10:38:54Z | 258,329 | <p>I'd recommend modifying your design to include some status field on A.</p>
<p>The issue is one of "why?" Why does A have < 2 B's and why does A have >= 2 B's. Is it because user's didn't enter something? Or is because they tried and their input had errors. Or is it because the < 2 rule doesn't apply in th... | 3 | 2008-11-03T11:00:13Z | [
"python",
"django",
"database-design"
] |
Django models - how to filter number of ForeignKey objects | 258,296 | <p>I have a models <code>A</code> and <code>B</code>, that are like this:</p>
<pre><code>class A(models.Model):
title = models.CharField(max_length=20)
(...)
class B(models.Model):
date = models.DateTimeField(auto_now_add=True)
(...)
a = models.ForeignKey(A)
</code></pre>
<p>Now I have some <code>A</code> ... | 33 | 2008-11-03T10:38:54Z | 845,814 | <p>I assume that joining or leaving the pool may not happen as often as listing (showing) the pools. I also believe that it would be more efficient for the users join/leave actions to update the pool display status. This way, listing & showing the pools would require less time as you would just run a single query f... | 1 | 2009-05-10T18:26:19Z | [
"python",
"django",
"database-design"
] |
Django models - how to filter number of ForeignKey objects | 258,296 | <p>I have a models <code>A</code> and <code>B</code>, that are like this:</p>
<pre><code>class A(models.Model):
title = models.CharField(max_length=20)
(...)
class B(models.Model):
date = models.DateTimeField(auto_now_add=True)
(...)
a = models.ForeignKey(A)
</code></pre>
<p>Now I have some <code>A</code> ... | 33 | 2008-11-03T10:38:54Z | 6,205,303 | <p>The question and selected answer are from 2008 and since then this functionality has been integrated into the django framework. Since this is a top google hit for "django filter foreign key count" I'd like to add an easier solution with a recent django version using <a href="https://docs.djangoproject.com/en/dev/to... | 90 | 2011-06-01T17:30:34Z | [
"python",
"django",
"database-design"
] |
Python filter/remove URLs from a list | 258,390 | <p>I have a text file of URLs, about 14000. Below is a couple of examples:</p>
<p><a href="http://www.domainname.com/pagename?CONTENT_ITEM_ID=100&param2=123" rel="nofollow">http://www.domainname.com/pagename?CONTENT_ITEM_ID=100&param2=123</a><br />
<a href="http://www.domainname.com/images?IMAGE_ID=10" rel="n... | 5 | 2008-11-03T11:34:18Z | 258,396 | <pre><code>list2 = filter( lambda x: x.find( 'CONTENT_ITEM_ID ') != -1, list1 )
</code></pre>
<p>The filter calls the function (first parameter) on each element of list1 (second parameter). If the function returns true (non-zero), the element is copied to the output list.</p>
<p>The lambda basically creates a tempor... | 5 | 2008-11-03T11:37:13Z | [
"python",
"url",
"list",
"filter"
] |
Python filter/remove URLs from a list | 258,390 | <p>I have a text file of URLs, about 14000. Below is a couple of examples:</p>
<p><a href="http://www.domainname.com/pagename?CONTENT_ITEM_ID=100&param2=123" rel="nofollow">http://www.domainname.com/pagename?CONTENT_ITEM_ID=100&param2=123</a><br />
<a href="http://www.domainname.com/images?IMAGE_ID=10" rel="n... | 5 | 2008-11-03T11:34:18Z | 258,415 | <p>Here's another alternative to Graeme's, using the newer list comprehension syntax:</p>
<pre><code>list2= [line for line in file if 'CONTENT_ITEM_ID' in line]
</code></pre>
<p>Which you prefer is a matter of taste!</p>
| 21 | 2008-11-03T11:45:47Z | [
"python",
"url",
"list",
"filter"
] |
Python filter/remove URLs from a list | 258,390 | <p>I have a text file of URLs, about 14000. Below is a couple of examples:</p>
<p><a href="http://www.domainname.com/pagename?CONTENT_ITEM_ID=100&param2=123" rel="nofollow">http://www.domainname.com/pagename?CONTENT_ITEM_ID=100&param2=123</a><br />
<a href="http://www.domainname.com/images?IMAGE_ID=10" rel="n... | 5 | 2008-11-03T11:34:18Z | 258,491 | <p>I liked @<a href="#258415">bobince</a>'s answer (+1), but will up the ante.</p>
<p>Since you have a rather large starting set, you may wish to avoid loading the entire list into memory. Unless you need the whole list for something else, you could use a <a href="http://www.python.org/doc/2.5.2/ref/genexpr.html">Pyth... | 6 | 2008-11-03T12:32:06Z | [
"python",
"url",
"list",
"filter"
] |
Python filter/remove URLs from a list | 258,390 | <p>I have a text file of URLs, about 14000. Below is a couple of examples:</p>
<p><a href="http://www.domainname.com/pagename?CONTENT_ITEM_ID=100&param2=123" rel="nofollow">http://www.domainname.com/pagename?CONTENT_ITEM_ID=100&param2=123</a><br />
<a href="http://www.domainname.com/images?IMAGE_ID=10" rel="n... | 5 | 2008-11-03T11:34:18Z | 258,512 | <p>For completeness; You can also use <code>ifilter</code>. It is like filter, but doesn't build up a list.</p>
<pre><code>from itertools import ifilter
for line in ifilter(lambda line: 'CONTENT_ITEM_ID' in line, urls):
do_something(line)
</code></pre>
| 5 | 2008-11-03T12:40:37Z | [
"python",
"url",
"list",
"filter"
] |
Slicing URL with Python | 258,746 | <p>I am working with a huge list of URL's. Just a quick question I have trying to slice a part of the URL out, see below:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3
</code></pre>
<p>How could I slice out:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234... | 8 | 2008-11-03T14:22:13Z | 258,797 | <p>I figured it out below is what I needed to do:</p>
<pre><code>url = "http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3"
url = url[: url.find("&")]
print url
'http://www.domainname.com/page?CONTENT_ITEM_ID=1234'
</code></pre>
| 1 | 2008-11-03T14:33:32Z | [
"python",
"url",
"string"
] |
Slicing URL with Python | 258,746 | <p>I am working with a huge list of URL's. Just a quick question I have trying to slice a part of the URL out, see below:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3
</code></pre>
<p>How could I slice out:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234... | 8 | 2008-11-03T14:22:13Z | 258,798 | <pre><code>import re
url = 'http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3'
m = re.search('(.*?)&', url)
print m.group(1)
</code></pre>
| 0 | 2008-11-03T14:34:17Z | [
"python",
"url",
"string"
] |
Slicing URL with Python | 258,746 | <p>I am working with a huge list of URL's. Just a quick question I have trying to slice a part of the URL out, see below:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3
</code></pre>
<p>How could I slice out:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234... | 8 | 2008-11-03T14:22:13Z | 258,800 | <p>The quick and dirty solution is this:</p>
<pre><code>>>> "http://something.com/page?CONTENT_ITEM_ID=1234&param3".split("&")[0]
'http://something.com/page?CONTENT_ITEM_ID=1234'
</code></pre>
| 4 | 2008-11-03T14:34:34Z | [
"python",
"url",
"string"
] |
Slicing URL with Python | 258,746 | <p>I am working with a huge list of URL's. Just a quick question I have trying to slice a part of the URL out, see below:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3
</code></pre>
<p>How could I slice out:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234... | 8 | 2008-11-03T14:22:13Z | 258,810 | <p>Another option would be to use the split function, with & as a parameter. That way, you'd extract both the base url and both parameters.</p>
<pre><code> url.split("&")
</code></pre>
<p>returns a list with</p>
<pre><code> ['http://www.domainname.com/page?CONTENT_ITEM_ID=1234', 'param2', 'param3']
</code... | 3 | 2008-11-03T14:36:06Z | [
"python",
"url",
"string"
] |
Slicing URL with Python | 258,746 | <p>I am working with a huge list of URL's. Just a quick question I have trying to slice a part of the URL out, see below:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3
</code></pre>
<p>How could I slice out:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234... | 8 | 2008-11-03T14:22:13Z | 258,832 | <p>Look at the <a href="http://stackoverflow.com/questions/163009/urllib2-file-name">urllib2 file name</a> question for some discussion of this topic.</p>
<p>Also see the "<a href="http://stackoverflow.com/questions/229352/python-find-question">Python Find Question</a>" question.</p>
| 0 | 2008-11-03T14:41:39Z | [
"python",
"url",
"string"
] |
Slicing URL with Python | 258,746 | <p>I am working with a huge list of URL's. Just a quick question I have trying to slice a part of the URL out, see below:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3
</code></pre>
<p>How could I slice out:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234... | 8 | 2008-11-03T14:22:13Z | 258,993 | <p>This method isn't dependent on the position of the parameter within the url string. This could be refined, I'm sure, but it gets the point across.</p>
<pre><code>url = 'http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3'
parts = url.split('?')
id = dict(i.split('=') for i in parts[1].split('&... | 0 | 2008-11-03T15:31:04Z | [
"python",
"url",
"string"
] |
Slicing URL with Python | 258,746 | <p>I am working with a huge list of URL's. Just a quick question I have trying to slice a part of the URL out, see below:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3
</code></pre>
<p>How could I slice out:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234... | 8 | 2008-11-03T14:22:13Z | 259,054 | <p>Parsin URL is never as simple I it seems to be, that's why there are the urlparse and urllib modules.</p>
<p>E.G :</p>
<pre><code>import urllib
url ="http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3"
query = urllib.splitquery(url)
result = "?".join((query[0], query[1].split("&")[0]))
p... | 1 | 2008-11-03T15:52:06Z | [
"python",
"url",
"string"
] |
Slicing URL with Python | 258,746 | <p>I am working with a huge list of URL's. Just a quick question I have trying to slice a part of the URL out, see below:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3
</code></pre>
<p>How could I slice out:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234... | 8 | 2008-11-03T14:22:13Z | 259,159 | <p>Use the <a href="http://docs.python.org/2/library/urlparse.html#urlparse.urlsplit" rel="nofollow">urlparse</a> module. Check this function:</p>
<pre><code>import urlparse
def process_url(url, keep_params=('CONTENT_ITEM_ID=',)):
parsed= urlparse.urlsplit(url)
filtered_query= '&'.join(
qry_item
... | 14 | 2008-11-03T16:25:13Z | [
"python",
"url",
"string"
] |
Slicing URL with Python | 258,746 | <p>I am working with a huge list of URL's. Just a quick question I have trying to slice a part of the URL out, see below:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3
</code></pre>
<p>How could I slice out:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234... | 8 | 2008-11-03T14:22:13Z | 2,326,780 | <p>An ancient question, but still, I'd like to remark that query string paramenters can also be separated by ';' not only '&'.</p>
| 0 | 2010-02-24T14:43:26Z | [
"python",
"url",
"string"
] |
Slicing URL with Python | 258,746 | <p>I am working with a huge list of URL's. Just a quick question I have trying to slice a part of the URL out, see below:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3
</code></pre>
<p>How could I slice out:</p>
<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234... | 8 | 2008-11-03T14:22:13Z | 11,576,768 | <p>beside <em>urlparse</em> there is also <a href="https://github.com/gruns/furl/" rel="nofollow">furl</a>, which has IMHO better API.</p>
| 0 | 2012-07-20T09:39:32Z | [
"python",
"url",
"string"
] |
Django: Overriding verbose_name for AutoField without dropping the model | 258,767 | <p>I am using <strong>0.97-pre-SVN-unknown</strong> release of Django.</p>
<p>I have a model for which I have not given any primary_key. Django, consequently, automatically provides an AutoField that is called "id". Everything's fine with that. But now, I have to change the "verbose_name" of that AutoField to somethin... | 3 | 2008-11-03T14:27:08Z | 259,027 | <p>Look into the command-line options for <code>manage.py</code>; there's a command to dump all of the model data to JSON, and another command to load it back in from JSON. You can export all of your model data, add your new field to the model, then import your data back in. Just make sure that you set the <code>db_col... | 2 | 2008-11-03T15:42:03Z | [
"python",
"django"
] |
Django: Overriding verbose_name for AutoField without dropping the model | 258,767 | <p>I am using <strong>0.97-pre-SVN-unknown</strong> release of Django.</p>
<p>I have a model for which I have not given any primary_key. Django, consequently, automatically provides an AutoField that is called "id". Everything's fine with that. But now, I have to change the "verbose_name" of that AutoField to somethin... | 3 | 2008-11-03T14:27:08Z | 259,077 | <p>Hmm... and what about explicitly write <em>id</em> field in the model definition? Like this for example:</p>
<pre><code>class Entry(models.Model):
id = models.AutoField(verbose_name="custom name")
# and other fields...
</code></pre>
<p>It doesn't require any underlying database changes.</p>
| 4 | 2008-11-03T15:57:31Z | [
"python",
"django"
] |
How to find out if a lazy relation isn't loaded yet, with SQLAlchemy? | 258,775 | <p>With SQLAlchemy, is there a way to know beforehand whether a relation would be lazy-loaded?<br />
For example, given a lazy parent->children relation and an instance X of "parent", I'd like to know if "X.children" is already loaded, without triggering the query.</p>
| 8 | 2008-11-03T14:28:03Z | 261,191 | <p>I think you could look at the child's <code>__dict__</code> attribute dictionary to check if the data is already there or not.</p>
| 2 | 2008-11-04T07:48:26Z | [
"python",
"sqlalchemy"
] |
How to find out if a lazy relation isn't loaded yet, with SQLAlchemy? | 258,775 | <p>With SQLAlchemy, is there a way to know beforehand whether a relation would be lazy-loaded?<br />
For example, given a lazy parent->children relation and an instance X of "parent", I'd like to know if "X.children" is already loaded, without triggering the query.</p>
| 8 | 2008-11-03T14:28:03Z | 14,335,831 | <p>Slightly neater than Haes answer (though it effectively does the same thing) is to use hasattr(), as in:</p>
<pre><code>>>> hasattr(X, 'children')
False
</code></pre>
| 3 | 2013-01-15T10:34:28Z | [
"python",
"sqlalchemy"
] |
How to find out if a lazy relation isn't loaded yet, with SQLAlchemy? | 258,775 | <p>With SQLAlchemy, is there a way to know beforehand whether a relation would be lazy-loaded?<br />
For example, given a lazy parent->children relation and an instance X of "parent", I'd like to know if "X.children" is already loaded, without triggering the query.</p>
| 8 | 2008-11-03T14:28:03Z | 25,011,704 | <p>You can get a list of all unloaded properties (both relations and columns) from <code>sqlalchemy.orm.attributes.instance_state(obj).unloaded</code>.</p>
<p>See: <a href="http://stackoverflow.com/questions/5795492/completing-object-with-its-relations-and-avoiding-unnecessary-queries-in-sqlalch">Completing object wit... | 6 | 2014-07-29T09:05:24Z | [
"python",
"sqlalchemy"
] |
python, functions running from a list and adding to a list through functions | 259,234 | <p>How do I run a function on a loop so all the results go straight into a list and is there a way to run a function which acts on all the values in a list?</p>
| 0 | 2008-11-03T16:46:57Z | 259,259 | <p>This example shows how to do it (run it in an interpreter)</p>
<pre><code>>>> def square(x):
... return x*x
...
>>> a = [1,2,3,4,5,6,7,8,9]
>>> map(square,a)
[1, 4, 9, 16, 25, 36, 49, 64, 81]
</code></pre>
| 0 | 2008-11-03T16:54:04Z | [
"python",
"function",
"list"
] |
python, functions running from a list and adding to a list through functions | 259,234 | <p>How do I run a function on a loop so all the results go straight into a list and is there a way to run a function which acts on all the values in a list?</p>
| 0 | 2008-11-03T16:46:57Z | 259,260 | <p>Your question needs clarification.</p>
<h3>run a function on a loop</h3>
<pre><code>new_list= [yourfunction(item) for item in a_sequence]
</code></pre>
<h3>run a function acting on all values in a list</h3>
<p>Your function should have some form of iteration in its code to process all items of a sequence, someth... | 1 | 2008-11-03T16:54:38Z | [
"python",
"function",
"list"
] |
python, functions running from a list and adding to a list through functions | 259,234 | <p>How do I run a function on a loop so all the results go straight into a list and is there a way to run a function which acts on all the values in a list?</p>
| 0 | 2008-11-03T16:46:57Z | 259,266 | <p>Theres a couple ways to run a function on a loop like that - You can either use a list comprehension</p>
<pre><code>test = list('asdf')
[function(x) for x in test]
</code></pre>
<p>and use that result</p>
<p>Or you could use the map function</p>
<pre><code>test = list('asdf')
map(function, test)
</code></pre>
<... | 6 | 2008-11-03T16:55:55Z | [
"python",
"function",
"list"
] |
python smtplib | 259,314 | <p>Hey I have a windows server running python CGI scripts and I'm having a little trouble with smtplib. The server is running python 2.1 (unfortunately and I can not upgrade it). Anyway I have the following code:</p>
<p><code><pre>
session = smtplib.SMTP("smtp-auth.ourhosting.com", 587)
session.login(smtpuser,... | -1 | 2008-11-03T17:09:05Z | 259,324 | <blockquote>
<p>Do it whatever way is expected by the libsmtp in python 2.1</p>
</blockquote>
| 0 | 2008-11-03T17:10:47Z | [
"python",
"smtp",
"smtplib",
"python-2.1"
] |
python smtplib | 259,314 | <p>Hey I have a windows server running python CGI scripts and I'm having a little trouble with smtplib. The server is running python 2.1 (unfortunately and I can not upgrade it). Anyway I have the following code:</p>
<p><code><pre>
session = smtplib.SMTP("smtp-auth.ourhosting.com", 587)
session.login(smtpuser,... | -1 | 2008-11-03T17:09:05Z | 259,432 | <p>login() was introduced in Python 2.2, unluckily for you! The only way to do it in Python 2.1's own smtplib would be to issue the AUTH commands manually, which wouldn't be much fun.</p>
<p>I haven't tested it fully but it seems Python 2.2's smtplib should more or less work on 2.1 if you copy it across as you describ... | 4 | 2008-11-03T18:01:51Z | [
"python",
"smtp",
"smtplib",
"python-2.1"
] |
How to extract frequency information from an input audio stream (using PortAudio)? | 259,451 | <p>I want to record sound (voice) using PortAudio (PyAudio) and output the corresponding sound wave on the screen. Hopeless as I am, I am unable to extract the frequency information from the audio stream so that I can draw it in Hz/time form.</p>
<p><hr /></p>
<p>Here's an example code snippet that records and plays ... | 2 | 2008-11-03T18:07:45Z | 259,521 | <p>What you want is probably the Fourier transform of the audio data. There is several packages that can calculate that for you. <code>scipy</code> and <code>numpy</code> is two of them. It is often named "Fast Fourier Transform" (FFT), but that is just the name of the algorithm.</p>
<p>Here is an example of it's usag... | 4 | 2008-11-03T18:31:46Z | [
"python",
"voice",
"frequency",
"portaudio"
] |
How to extract frequency information from an input audio stream (using PortAudio)? | 259,451 | <p>I want to record sound (voice) using PortAudio (PyAudio) and output the corresponding sound wave on the screen. Hopeless as I am, I am unable to extract the frequency information from the audio stream so that I can draw it in Hz/time form.</p>
<p><hr /></p>
<p>Here's an example code snippet that records and plays ... | 2 | 2008-11-03T18:07:45Z | 569,314 | <p>The Fourier Transform will not help you a lot if you want the analysis to be conducted in both the frequency and time domain. You might want to have a look at "Wavelet Transforms". There is a package called pywavelets...
<a href="http://www.pybytes.com/pywavelets/#discrete-wavelet-transform-dwt" rel="nofollow">http:... | 1 | 2009-02-20T11:52:06Z | [
"python",
"voice",
"frequency",
"portaudio"
] |
Credit card payments and notifications on the Google App Engine | 259,491 | <p>I ported gchecky to the google app engine. you can <a href="http://web2py.appspot.com/plugin_checkout" rel="nofollow">try it here</a></p>
<p>It implements both level 1 (cart submission) and level 2 (notifications from google checkout).</p>
<p>Is there any other payment option that works on the google app engine (p... | 13 | 2008-11-03T18:22:17Z | 431,474 | <p>Paypal has a <a href="https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_soap_PayPalSOAPAPIArchitecture" rel="nofollow">SOAP interface</a>. You can certainly access that from within GAE--though you might run into timeout issues while waiting for the response.</p>
| 4 | 2009-01-10T18:17:17Z | [
"python",
"google-app-engine",
"web2py"
] |
Credit card payments and notifications on the Google App Engine | 259,491 | <p>I ported gchecky to the google app engine. you can <a href="http://web2py.appspot.com/plugin_checkout" rel="nofollow">try it here</a></p>
<p>It implements both level 1 (cart submission) and level 2 (notifications from google checkout).</p>
<p>Is there any other payment option that works on the google app engine (p... | 13 | 2008-11-03T18:22:17Z | 1,136,350 | <p>Here's a <a href="http://blog.awarelabs.com/2008/paypal-ipn-python-code/" rel="nofollow">link</a> containing information about using PayPal IPN from AppEngine using Django.</p>
| 2 | 2009-07-16T09:09:14Z | [
"python",
"google-app-engine",
"web2py"
] |
Credit card payments and notifications on the Google App Engine | 259,491 | <p>I ported gchecky to the google app engine. you can <a href="http://web2py.appspot.com/plugin_checkout" rel="nofollow">try it here</a></p>
<p>It implements both level 1 (cart submission) and level 2 (notifications from google checkout).</p>
<p>Is there any other payment option that works on the google app engine (p... | 13 | 2008-11-03T18:22:17Z | 3,628,409 | <p>I think you can have a look into the official toolkit from PayPal's X Platform <a href="http://code.google.com/p/paypalx-gae-toolkit/">http://code.google.com/p/paypalx-gae-toolkit/</a></p>
| 5 | 2010-09-02T15:03:41Z | [
"python",
"google-app-engine",
"web2py"
] |
Is it safe to make an old-style class into a new-style class using Multiple Inheritance? | 259,578 | <p>In a program that I'm writing, I wanted to make a ConfigParser that's read only so that it can safely be used globally. I didn't realize this, but apparently the SafeConfigParser is an old-style class, thus I had to subclass it like this:</p>
<pre><code>class ConstParser(SafeConfigParser, object):
"""This is ... | 7 | 2008-11-03T18:54:04Z | 259,729 | <p>Replace the call:</p>
<pre><code>super(ConstParser, self).__init__(defaults)
</code></pre>
<p>with:</p>
<pre><code>SafeConfigParser.__init__(self, defaults)
</code></pre>
<p>and it works just fine without multiple Inheritance.</p>
| 2 | 2008-11-03T19:57:22Z | [
"python",
"oop"
] |
Splitting a person's name into forename and surname | 259,634 | <p>ok so basically I am asking the question of their name
I want this to be one input rather than Forename and Surname.</p>
<p>Now is there any way of splitting this name? and taking just the last word from the "Sentence" e.g.</p>
<pre><code>name = "Thomas Winter"
print name.split()
</code></pre>
<p>and what would b... | 17 | 2008-11-03T19:19:09Z | 259,638 | <p>Like this:</p>
<pre><code>print name.split()[-1]
</code></pre>
| 1 | 2008-11-03T19:20:27Z | [
"python",
"split"
] |
Splitting a person's name into forename and surname | 259,634 | <p>ok so basically I am asking the question of their name
I want this to be one input rather than Forename and Surname.</p>
<p>Now is there any way of splitting this name? and taking just the last word from the "Sentence" e.g.</p>
<pre><code>name = "Thomas Winter"
print name.split()
</code></pre>
<p>and what would b... | 17 | 2008-11-03T19:19:09Z | 259,639 | <p>you'd probably want to use rsplit for this:</p>
<p>rsplit([sep [,maxsplit]])</p>
<p>Return a list of the words in the string, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done, the rightmost ones. If sep is not specified or None, any whitespace string is a separator. Except ... | 0 | 2008-11-03T19:21:27Z | [
"python",
"split"
] |
Splitting a person's name into forename and surname | 259,634 | <p>ok so basically I am asking the question of their name
I want this to be one input rather than Forename and Surname.</p>
<p>Now is there any way of splitting this name? and taking just the last word from the "Sentence" e.g.</p>
<pre><code>name = "Thomas Winter"
print name.split()
</code></pre>
<p>and what would b... | 17 | 2008-11-03T19:19:09Z | 259,643 | <p>The problem with trying to split the names from a single input is that you won't get the full surname for people with spaces in their surname, and I don't believe you'll be able to write code to manage that completely.</p>
<p>I would recommend that you ask for the names separately if it is at all possible.</p>
| 15 | 2008-11-03T19:23:04Z | [
"python",
"split"
] |
Splitting a person's name into forename and surname | 259,634 | <p>ok so basically I am asking the question of their name
I want this to be one input rather than Forename and Surname.</p>
<p>Now is there any way of splitting this name? and taking just the last word from the "Sentence" e.g.</p>
<pre><code>name = "Thomas Winter"
print name.split()
</code></pre>
<p>and what would b... | 17 | 2008-11-03T19:19:09Z | 259,659 | <p>Splitting names is harder than it looks. Some names have two word last names; some people will enter a first, middle, and last name; some names have two work first names. The more reliable (or least unreliable) way to handle names is to always capture first and last name in separate fields. Of course this raises ... | 2 | 2008-11-03T19:30:06Z | [
"python",
"split"
] |
Splitting a person's name into forename and surname | 259,634 | <p>ok so basically I am asking the question of their name
I want this to be one input rather than Forename and Surname.</p>
<p>Now is there any way of splitting this name? and taking just the last word from the "Sentence" e.g.</p>
<pre><code>name = "Thomas Winter"
print name.split()
</code></pre>
<p>and what would b... | 17 | 2008-11-03T19:19:09Z | 259,662 | <p><a href="http://stackoverflow.com/questions/159567/how-can-i-parse-the-first-middle-and-last-name-from-a-full-name-field-in-sql#159760">Here's how to do it in SQL</a>. But data normalization with this kind of thing is really a bear. I agree with Dave DuPlantis about asking for separate inputs.</p>
| 0 | 2008-11-03T19:30:41Z | [
"python",
"split"
] |
Splitting a person's name into forename and surname | 259,634 | <p>ok so basically I am asking the question of their name
I want this to be one input rather than Forename and Surname.</p>
<p>Now is there any way of splitting this name? and taking just the last word from the "Sentence" e.g.</p>
<pre><code>name = "Thomas Winter"
print name.split()
</code></pre>
<p>and what would b... | 17 | 2008-11-03T19:19:09Z | 259,694 | <p>You'll find that your key problem with this approach isn't a technical one, but a human one - different people write their names in different ways.</p>
<p>In fact, the terminology of "forename" and "surname" is itself flawed.</p>
<p>While many blended families use a hyphenated family name, such as Smith-Jones, the... | 57 | 2008-11-03T19:42:02Z | [
"python",
"split"
] |
Splitting a person's name into forename and surname | 259,634 | <p>ok so basically I am asking the question of their name
I want this to be one input rather than Forename and Surname.</p>
<p>Now is there any way of splitting this name? and taking just the last word from the "Sentence" e.g.</p>
<pre><code>name = "Thomas Winter"
print name.split()
</code></pre>
<p>and what would b... | 17 | 2008-11-03T19:19:09Z | 259,735 | <p>I would specify a standard format (some forms use them), such as "Please write your name in <em>First name, Surname</em> form".</p>
<p>It makes it easier for you, as names don't usually contain a comma. It also verifies that your users actually enter both first name and surname.</p>
| 0 | 2008-11-03T19:59:30Z | [
"python",
"split"
] |
Splitting a person's name into forename and surname | 259,634 | <p>ok so basically I am asking the question of their name
I want this to be one input rather than Forename and Surname.</p>
<p>Now is there any way of splitting this name? and taking just the last word from the "Sentence" e.g.</p>
<pre><code>name = "Thomas Winter"
print name.split()
</code></pre>
<p>and what would b... | 17 | 2008-11-03T19:19:09Z | 259,804 | <p>Golden rule of data - don't aggregate too early - it is much easier to glue fields together than separate them. Most people also have a middle name which should be an optional field. Some people have a plethora of middle names. Some people only have <a href="https://stilgherrian.com/category/only-one-name/" rel="nof... | 5 | 2008-11-03T20:18:25Z | [
"python",
"split"
] |
Splitting a person's name into forename and surname | 259,634 | <p>ok so basically I am asking the question of their name
I want this to be one input rather than Forename and Surname.</p>
<p>Now is there any way of splitting this name? and taking just the last word from the "Sentence" e.g.</p>
<pre><code>name = "Thomas Winter"
print name.split()
</code></pre>
<p>and what would b... | 17 | 2008-11-03T19:19:09Z | 259,809 | <p>An easy way to do exactly what you asked in python is </p>
<pre><code>name = "Thomas Winter"
LastName = name.split()[1]
</code></pre>
<p>(note the parantheses on the function call split.)</p>
<p>split() creates a list where each element is from your original string, delimited by whitespace. You can now grab the s... | 3 | 2008-11-03T20:20:52Z | [
"python",
"split"
] |
Splitting a person's name into forename and surname | 259,634 | <p>ok so basically I am asking the question of their name
I want this to be one input rather than Forename and Surname.</p>
<p>Now is there any way of splitting this name? and taking just the last word from the "Sentence" e.g.</p>
<pre><code>name = "Thomas Winter"
print name.split()
</code></pre>
<p>and what would b... | 17 | 2008-11-03T19:19:09Z | 263,331 | <p>Since there are so many different variation's of how people write their names, but here's how a basic way to get the first/lastname via regex.</p>
<pre><code>import re
p = re.compile(r'^(\s+)?(Mr(\.)?|Mrs(\.)?)?(?P<FIRST_NAME>.+)(\s+)(?P<LAST_NAME>.+)$', re.IGNORECASE)
m = p.match('Mr. Dingo Bat')
if(m ... | 1 | 2008-11-04T20:35:29Z | [
"python",
"split"
] |
Splitting a person's name into forename and surname | 259,634 | <p>ok so basically I am asking the question of their name
I want this to be one input rather than Forename and Surname.</p>
<p>Now is there any way of splitting this name? and taking just the last word from the "Sentence" e.g.</p>
<pre><code>name = "Thomas Winter"
print name.split()
</code></pre>
<p>and what would b... | 17 | 2008-11-03T19:19:09Z | 1,656,251 | <p>If you're trying to parse apart a human name in PHP, I recomment <a href="http://jonathonhill.net/2009-10-31/human-name-parsing-in-php/" rel="nofollow">Keith Beckman's nameparse.php script</a>.</p>
| 3 | 2009-11-01T02:45:02Z | [
"python",
"split"
] |
Splitting a person's name into forename and surname | 259,634 | <p>ok so basically I am asking the question of their name
I want this to be one input rather than Forename and Surname.</p>
<p>Now is there any way of splitting this name? and taking just the last word from the "Sentence" e.g.</p>
<pre><code>name = "Thomas Winter"
print name.split()
</code></pre>
<p>and what would b... | 17 | 2008-11-03T19:19:09Z | 2,862,586 | <p>This is a pretty old issue but I found it searching around for a solution to parsing out pieces from a globbed together name.</p>
<p><a href="http://code.google.com/p/python-nameparser/" rel="nofollow">http://code.google.com/p/python-nameparser/</a></p>
| 4 | 2010-05-19T03:05:27Z | [
"python",
"split"
] |
Splitting a person's name into forename and surname | 259,634 | <p>ok so basically I am asking the question of their name
I want this to be one input rather than Forename and Surname.</p>
<p>Now is there any way of splitting this name? and taking just the last word from the "Sentence" e.g.</p>
<pre><code>name = "Thomas Winter"
print name.split()
</code></pre>
<p>and what would b... | 17 | 2008-11-03T19:19:09Z | 3,688,828 | <p>It's definitely a more complicated task than it appears on the surface. I wrote up some of the challenges as well as my algorithm for solving it on my blog. Be sure to check out my Google Code project for it if you want the latest version in PHP:</p>
<p><a href="http://www.onlineaspect.com/2009/08/17/splitting-na... | 1 | 2010-09-10T22:28:26Z | [
"python",
"split"
] |
Splitting a person's name into forename and surname | 259,634 | <p>ok so basically I am asking the question of their name
I want this to be one input rather than Forename and Surname.</p>
<p>Now is there any way of splitting this name? and taking just the last word from the "Sentence" e.g.</p>
<pre><code>name = "Thomas Winter"
print name.split()
</code></pre>
<p>and what would b... | 17 | 2008-11-03T19:19:09Z | 9,305,240 | <p>This is how I do it in my application:</p>
<pre><code>def get_first_name(fullname):
firstname = ''
try:
firstname = fullname.split()[0]
except Exception as e:
print str(e)
return firstname
def get_last_name(fullname):
lastname = ''
try:
index=0
for part in f... | 2 | 2012-02-16T03:45:20Z | [
"python",
"split"
] |
Does Python 2.5 include a package to natively transform an XML document? | 259,782 | <p>In my Python app, I have an XML document that I'd like to transform using my XSL file. I'm currently using xml.etree to generate the XML document, but I haven't found anything within Python 2.5 that will allow me to natively transform my XML document.</p>
<p>I've already found one library (<a href="http://xmlsoft.... | 3 | 2008-11-03T20:14:00Z | 259,818 | <p>There is no XSLT processor in Python 2.5.</p>
| 4 | 2008-11-03T20:22:57Z | [
"python",
"xml",
"xslt",
"elementtree"
] |
Does Python 2.5 include a package to natively transform an XML document? | 259,782 | <p>In my Python app, I have an XML document that I'd like to transform using my XSL file. I'm currently using xml.etree to generate the XML document, but I haven't found anything within Python 2.5 that will allow me to natively transform my XML document.</p>
<p>I've already found one library (<a href="http://xmlsoft.... | 3 | 2008-11-03T20:14:00Z | 260,148 | <p>If you have libxml2 and libxslt installed, then also install <a href="http://codespeak.net/lxml/" rel="nofollow">lxml</a>. It provides a nice, easy-to-use binding for libxml2 and libxslt, and it also implements the ElementTree API.</p>
<p>libxml2/libxslt also come with their own, much lower-level Python bindings, ... | 5 | 2008-11-03T22:03:08Z | [
"python",
"xml",
"xslt",
"elementtree"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 260,075 | <p>The fundamental assumption is flawed, I think. you can't map hashes to regular expressions. </p>
| 0 | 2008-11-03T21:44:21Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 260,077 | <p>This is not possible to do with a regular hash table in any language. You'll either have to iterate through the entire keyset, attempting to match the key to your regex, or use a different data structure.</p>
<p>You should choose a data structure that is appropriate to the problem you're trying to solve. If you h... | 4 | 2008-11-03T21:44:41Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 260,079 | <p>I don't think it's even theoretically possible. What happens if someone passes in a string that matches more than 1 regular expression. </p>
<p>For example, what would happen if someone did:</p>
<pre><code>>>> regex_dict['FileNfoo']
</code></pre>
<p>How can something like that possibly be O(1)?</p>
| 0 | 2008-11-03T21:44:49Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 260,085 | <p>What happens if you have a dictionary such as</p>
<pre><code>regex_dict = { re.compile("foo.*"): 5, re.compile("f.*"): 6 }
</code></pre>
<p>In this case <code>regex_dict["food"]</code> could legitimately return either 5 or 6.</p>
<p>Even ignoring that problem, there's probably no way to do this efficiently with t... | 2 | 2008-11-03T21:46:56Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 260,114 | <p>In the general case, what you need is a lexer generator. It takes a bunch of regular expressions and compiles them into a recognizer. "lex" will work if you are using C. I have never used a lexer generator in Python, but there seem to be a few to choose from. Google shows <a href="http://www.dabeaz.com/ply/" rel... | 4 | 2008-11-03T21:53:03Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 260,120 | <p>As other respondents have pointed out, it's not possible to do this with a hash table in constant time.</p>
<p>One approximation that might help is to use a technique called <a href="http://en.wikipedia.org/wiki/Ngram#n-grams_for_approximate_matching" rel="nofollow">"n-grams"</a>. Create an inverted index from n-ch... | 1 | 2008-11-03T21:54:01Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 260,421 | <p>It <em>may</em> be possible to get the regex compiler to do most of the work for you by concatenating the search expressions into one big regexp, separated by "|". A clever regex compiler might search for commonalities in the alternatives in such a case, and devise a more efficient search strategy than simply check... | 0 | 2008-11-04T00:13:40Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 260,591 | <p>It really depends on what these regexes look like. If you don't have a lot regexes that will match almost anything like '<code>.*</code>' or '<code>\d+</code>', and instead you have regexes that <em>contains</em> mostly words and phrases or any fixed patterns longer than 4 characters (e.g.'<code>a*b*c</code>' in <co... | 0 | 2008-11-04T01:57:30Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 260,886 | <p>There is a Perl module that does just this <a href="http://search.cpan.org/~davecross/Tie-Hash-Regex-1.02/lib/Tie/Hash/Regex.pm" rel="nofollow">Tie::Hash::Regex</a>.</p>
<pre><code>use Tie::Hash::Regex;
my %h;
tie %h, 'Tie::Hash::Regex';
$h{key} = 'value';
$h{key2} = 'another value';
$h{stuff} = 'something els... | 2 | 2008-11-04T04:31:23Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 260,942 | <p>A special case of this problem came up in the 70s AI languages oriented around deductive databases. The keys in these databases could be patterns with variables -- like regular expressions without the * or | operators. They tended to use fancy extensions of trie structures for indexes. See krep*.lisp in Norvig's <a ... | 1 | 2008-11-04T05:02:57Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 261,070 | <p>This is definitely possible, as long as you're using 'real' regular expressions. A textbook regular expression is something that can be recognized by a <a href="http://en.wikipedia.org/wiki/Deterministic_finite_state_machine" rel="nofollow">deterministic finite state machine</a>, which primarily means you can't hav... | 4 | 2008-11-04T06:30:01Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 261,755 | <p>If you have a small set of possible inputs, you can cache the matches as they appear in a second dict and get O(1) for the cached values.</p>
<p>If the set of possible inputs is too big to cache but not infinite, either, you can just keep the last N matches in the cache (check Google for "LRU maps" - least recently... | 1 | 2008-11-04T12:39:42Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 266,620 | <p>What you want to do is very similar to what is supported by xrdb. They only support a fairly minimal notion of globbing however.</p>
<p>Internally you can implement a larger family of regular languages than theirs by storing your regular expressions as a character trie. </p>
<ul>
<li>single characters just become ... | 4 | 2008-11-05T20:52:08Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 267,747 | <p>I created this exact data structure for a project once. I implemented it naively, as you suggested. I did make two immensely helpful optimizations, which may or may not be feasible for you, depending on the size of your data:</p>
<ul>
<li>Memoizing the hash lookups</li>
<li>Pre-seeding the the memoization table (... | 1 | 2008-11-06T05:55:42Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 816,047 | <p>What about the following:</p>
<pre><code>class redict(dict):
def __init__(self, d):
dict.__init__(self, d)
def __getitem__(self, regex):
r = re.compile(regex)
mkeys = filter(r.match, self.keys())
for i in mkeys:
yield dict.__getitem__(self, i)
</code></pre>
<p>It's basically a subclass of the dict type in P... | 3 | 2009-05-03T01:18:14Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 5,835,497 | <p>Ok, I have a very similar requirements, I have a lot of lines of different syntax, basically remark lines and lines with some codes for to use in a process of smart-card format, also, descriptor lines of keys and secret codes, in every case, I think that the "model" pattern/action is the beast approach for to recog... | 0 | 2011-04-29T17:50:33Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 10,190,682 | <p>The problem has nothing to do with regular expressions - you'd have the same problem with a dictionary with keys as functions of lambdas. So the problem you face is figuring is there a way of classifying your functions to figure which will return true or not and that isn't a search problem because f(x) is not known ... | 0 | 2012-04-17T11:51:38Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 16,875,839 | <p>Here's an efficient way to do it by combining the keys into a single compiled regexp, and so not requiring any looping over key patterns. It abuses the <code>lastindex</code> to find out which key matched. (It's a shame regexp libraries don't let you tag the terminal state of the DFA that a regexp is compiled to, ... | 3 | 2013-06-01T18:20:58Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Hashtable/dictionary/map lookup with regular expressions | 260,056 | <p>I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):</p>
<pre><code>>>>... | 18 | 2008-11-03T21:39:38Z | 16,878,309 | <p>@rptb1 you don't have to avoid capturing groups, because you can use re.groups to count them. Like this:</p>
<pre><code># Regular expression map
# Abuses match.lastindex to figure out which key was matched
# (i.e. to emulate extracting the terminal state of the DFA of the regexp engine)
# Mostly for amusement.
# R... | 2 | 2013-06-01T23:32:46Z | [
"python",
"regex",
"dictionary",
"hash"
] |
Most efficient way to search the last x lines of a file in python | 260,273 | <p>I have a file and I don't know how big it's going to be (it could be quite large, but the size will vary greatly). I want to search the last 10 lines or so to see if any of them match a string. I need to do this as quickly and efficiently as possible and was wondering if there's anything better than:</p>
<pre><co... | 29 | 2008-11-03T23:01:50Z | 260,282 | <p>read the last few Ks of the file, and split that into lines to return only the last 10.</p>
<p>it's quite unlikely the start of that chunk to fall on a line boundary, but you'll discard the first lines anyway.</p>
| 0 | 2008-11-03T23:05:34Z | [
"python",
"file",
"search"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.