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 |
|---|---|---|---|---|---|---|---|---|---|
Python: Random sequence | 2,393,851 | <p>I have the following code:</p>
<pre><code>import string
import random
d =[random.choice(string.uppercase) for x in xrange(3355)]
s = "".join(d)
print s
</code></pre>
<p>At the moment it prints out a random sequence of letters from the alphabet. But, i need it to print out a sequence of letters containing only fo... | 1 | 2010-03-06T19:40:31Z | 2,393,857 | <p>Change the set you are asking <code>random.choice</code> to pick from:</p>
<pre><code>import random
d =[random.choice('ACUG') for x in xrange(3355)]
s = "".join(d)
print s
</code></pre>
<hr>
<p><strong>Edit:</strong> As SilentGhost points out, if your ultimate goal is only to make a string, skipping the interme... | 2 | 2010-03-06T19:42:14Z | [
"python"
] |
Python: Random sequence | 2,393,851 | <p>I have the following code:</p>
<pre><code>import string
import random
d =[random.choice(string.uppercase) for x in xrange(3355)]
s = "".join(d)
print s
</code></pre>
<p>At the moment it prints out a random sequence of letters from the alphabet. But, i need it to print out a sequence of letters containing only fo... | 1 | 2010-03-06T19:40:31Z | 2,393,877 | <p>Your question is not clear. Do you mean that you want to choose a string only 4 in length? If so then do:</p>
<pre><code>d =[random.choice(string.uppercase) for x in xrange(4)]
</code></pre>
<p>Or if you want to choose from a list of only four choices, then do:</p>
<pre><code>d =[random.choice("ACUG") for x in ... | 0 | 2010-03-06T19:47:48Z | [
"python"
] |
Python: Random sequence | 2,393,851 | <p>I have the following code:</p>
<pre><code>import string
import random
d =[random.choice(string.uppercase) for x in xrange(3355)]
s = "".join(d)
print s
</code></pre>
<p>At the moment it prints out a random sequence of letters from the alphabet. But, i need it to print out a sequence of letters containing only fo... | 1 | 2010-03-06T19:40:31Z | 2,393,903 | <p>I <em>think</em> the OP is wanting to pre-select a 4-character sample from string.uppercase, then create a 3355 item string based on that:</p>
<pre><code>import string
import random
num_samples = 4
char_sample = random.sample(string.uppercase, num_samples)
d =[random.choice(char_sample) for x in xrange(3355)]
s = ... | 0 | 2010-03-06T19:55:40Z | [
"python"
] |
How many items in a dictionary share the same value in Python | 2,393,902 | <p>Is there a way to see how many items in a dictionary share the same value in Python?</p>
<p>Let's say that I have a dictionary like:</p>
<pre><code>{"a": 600, "b": 75, "c": 75, "d": 90}
</code></pre>
<p>I'd like to get a resulting dictionary like:</p>
<pre><code>{600: 1, 75: 2, 90: 1}
</code></pre>
<p>My first ... | 1 | 2010-03-06T19:55:10Z | 2,393,918 | <pre><code>>>> a = {"a": 600, "b": 75, "c": 75, "d": 90}
>>> b = {}
>>> for k,v in a.iteritems():
... b[v] = b.get(v,0) + 1
...
>>> b
{600: 1, 90: 1, 75: 2}
>>>
</code></pre>
| 1 | 2010-03-06T19:59:29Z | [
"python",
"dictionary"
] |
How many items in a dictionary share the same value in Python | 2,393,902 | <p>Is there a way to see how many items in a dictionary share the same value in Python?</p>
<p>Let's say that I have a dictionary like:</p>
<pre><code>{"a": 600, "b": 75, "c": 75, "d": 90}
</code></pre>
<p>I'd like to get a resulting dictionary like:</p>
<pre><code>{600: 1, 75: 2, 90: 1}
</code></pre>
<p>My first ... | 1 | 2010-03-06T19:55:10Z | 2,393,919 | <p>You could use itertools.groupby for this.</p>
<pre><code>import itertools
x = {"a": 600, "b": 75, "c": 75, "d": 90}
[(k, len(list(v))) for k, v in itertools.groupby(sorted(x.values()))]
</code></pre>
| 6 | 2010-03-06T19:59:34Z | [
"python",
"dictionary"
] |
How many items in a dictionary share the same value in Python | 2,393,902 | <p>Is there a way to see how many items in a dictionary share the same value in Python?</p>
<p>Let's say that I have a dictionary like:</p>
<pre><code>{"a": 600, "b": 75, "c": 75, "d": 90}
</code></pre>
<p>I'd like to get a resulting dictionary like:</p>
<pre><code>{600: 1, 75: 2, 90: 1}
</code></pre>
<p>My first ... | 1 | 2010-03-06T19:55:10Z | 2,393,924 | <p>Use <a href="http://docs.python.org/dev/library/collections.html#counter-objects" rel="nofollow"><code>Counter</code></a> (2.7+, see below at link for implementations for older versions) along with <code>dict.values()</code>.</p>
| 0 | 2010-03-06T20:00:04Z | [
"python",
"dictionary"
] |
How many items in a dictionary share the same value in Python | 2,393,902 | <p>Is there a way to see how many items in a dictionary share the same value in Python?</p>
<p>Let's say that I have a dictionary like:</p>
<pre><code>{"a": 600, "b": 75, "c": 75, "d": 90}
</code></pre>
<p>I'd like to get a resulting dictionary like:</p>
<pre><code>{600: 1, 75: 2, 90: 1}
</code></pre>
<p>My first ... | 1 | 2010-03-06T19:55:10Z | 2,393,939 | <p>When Python 2.7 comes out you can use its <a href="http://docs.python.org/dev/library/collections.html#collections.Counter" rel="nofollow">collections.Counter class</a></p>
<p>otherwise see <a href="http://code.activestate.com/recipes/576611/" rel="nofollow">counter receipe</a></p>
<p>Under Python 2.7a3 </p>
<pre... | 2 | 2010-03-06T20:03:21Z | [
"python",
"dictionary"
] |
How many items in a dictionary share the same value in Python | 2,393,902 | <p>Is there a way to see how many items in a dictionary share the same value in Python?</p>
<p>Let's say that I have a dictionary like:</p>
<pre><code>{"a": 600, "b": 75, "c": 75, "d": 90}
</code></pre>
<p>I'd like to get a resulting dictionary like:</p>
<pre><code>{600: 1, 75: 2, 90: 1}
</code></pre>
<p>My first ... | 1 | 2010-03-06T19:55:10Z | 2,394,751 | <pre><code>>>> a = {"a": 600, "b": 75, "c": 75, "d": 90}
>>> d={}
>>> for v in a.values():
... if not v in d: d[v]=1
... else: d[v]+=1
...
>>> d
{600: 1, 90: 1, 75: 2}
</code></pre>
| 0 | 2010-03-07T01:10:19Z | [
"python",
"dictionary"
] |
Is there a better way to parse html tables than lxml | 2,393,917 | <p>I am working with html documents and ripping out tables to parse them if they turn out to be the correct tables. I am happy with the results - my extraction process successfully maps row labels and column headings in over 95% of the cases and in the cases it does not we can identify the problems and use other appro... | 0 | 2010-03-06T19:59:27Z | 2,393,941 | <p>Actually, browser engines are deliberately stupid in their parsing of HTML, assuming that what they get is only marginally correct. lxml and BeautifulSoup attempt to mimic this level of stupidity, so they are the correct tools to use.</p>
| 2 | 2010-03-06T20:03:46Z | [
"python",
"browser",
"lxml"
] |
Is there a better way to parse html tables than lxml | 2,393,917 | <p>I am working with html documents and ripping out tables to parse them if they turn out to be the correct tables. I am happy with the results - my extraction process successfully maps row labels and column headings in over 95% of the cases and in the cases it does not we can identify the problems and use other appro... | 0 | 2010-03-06T19:59:27Z | 2,394,472 | <p>To "harness the 'engine' of a browser", your best bet at this time is no doubt <a href="http://seleniumhq.org/projects/remote-control/" rel="nofollow">SeleniumRC</a> -- however its main advantage is in handling <em>javascript</em> "just like the browser would" (there are few other options for that); for a table that... | 2 | 2010-03-06T23:25:53Z | [
"python",
"browser",
"lxml"
] |
Calling an executable from within Python / Django web application running on IIS | 2,394,054 | <p>I have a Python / Django application which is supposed to call an external windows binary and get its output at some point. And it does so when tested via 'python manage.py shell'.</p>
<p>But when it is run from within the web browser, which is served by IIS, the external application is not executed. </p>
<p>Is II... | 1 | 2010-03-06T20:48:13Z | 2,395,623 | <p>Might be a permissions issue. when you run from the shell, you're using the user that run the <code>python manage.py shell</code> command. When serving requests from the IIS you're using its user (IUSR or something like that). Try giving execution permission on the executable file to the Everyone group just to see i... | 0 | 2010-03-07T08:21:10Z | [
"python",
"windows",
"django",
"iis",
"executable"
] |
Detecting a US Holiday | 2,394,235 | <p>What's the simplest way to determine if a date is a U.S. bank holiday in Python? There seem to be various calendars and webservices listing holidays for various countries, but I haven't found anything specific to banks in the U.S. </p>
| 8 | 2010-03-06T21:55:32Z | 2,394,242 | <p>Make sure date != one of these:</p>
<p><a href="http://www.buyusa.gov/uk/en/us_bank_holidays.html" rel="nofollow">http://www.buyusa.gov/uk/en/us_bank_holidays.html</a></p>
| 3 | 2010-03-06T21:58:44Z | [
"python",
"date",
"bank"
] |
Detecting a US Holiday | 2,394,235 | <p>What's the simplest way to determine if a date is a U.S. bank holiday in Python? There seem to be various calendars and webservices listing holidays for various countries, but I haven't found anything specific to banks in the U.S. </p>
| 8 | 2010-03-06T21:55:32Z | 2,394,287 | <p>I've actually worked recently on a problem much like this one. The static holidays are rather trivial to generate (e.g. New Years Eve - December 31st, (cycle through years)). There are well defined algorithms out there to generate the floating holidays. Essentially you have a starting date (e.g. January 1st, 1900) a... | 2 | 2010-03-06T22:12:55Z | [
"python",
"date",
"bank"
] |
Detecting a US Holiday | 2,394,235 | <p>What's the simplest way to determine if a date is a U.S. bank holiday in Python? There seem to be various calendars and webservices listing holidays for various countries, but I haven't found anything specific to banks in the U.S. </p>
| 8 | 2010-03-06T21:55:32Z | 2,394,641 | <p>Some general comments:</p>
<p>I don't think that @ast4 really means "nth day of nth week of nth month algorithm". The notion of "nth week in nth month" is mind-snapping (like the "ISO calendar"). I've never seen a holiday defined in terms of "nth week". Martin Luther King Day is an example of the"Nth weekday in mon... | 5 | 2010-03-07T00:23:39Z | [
"python",
"date",
"bank"
] |
Detecting a US Holiday | 2,394,235 | <p>What's the simplest way to determine if a date is a U.S. bank holiday in Python? There seem to be various calendars and webservices listing holidays for various countries, but I haven't found anything specific to banks in the U.S. </p>
| 8 | 2010-03-06T21:55:32Z | 24,645,696 | <p>The <a href="http://pandas.pydata.org/pandas-docs/stable/timeseries.html#datetimeindex" rel="nofollow">Pandas</a> package provides a convenient solution for this:</p>
<pre><code>from pandas.tseries.holiday import USFederalHolidayCalendar
cal = USFederalHolidayCalendar()
holidays = cal.holidays(start='2014-01-01', e... | 1 | 2014-07-09T04:58:57Z | [
"python",
"date",
"bank"
] |
pycurl READFUNCTION with a bytestream | 2,394,258 | <p>Is there a way to write a callback function for pycurl's READFUNCTION that does not return a string? I am planning on sending blocks of binary data via pycurl. i tried writing a callback function that does this:</p>
<pre>def read_callback(self, size):
for block in data:
yield block
</pre>
<p>but pycurl exits... | 0 | 2010-03-06T22:04:39Z | 2,394,416 | <p>The "read function" must return a string of bytes -- remember, libcurl is a wrapper on an underlying C library, so of course it's type-picky!-). However, it can perfectly be a binary string of bytes (in Python <code>2.*</code> at least -- I don't think pycurl works with Python 3 anyway), so of course it can return ... | 1 | 2010-03-06T23:06:13Z | [
"python",
"pycurl"
] |
Best method of connection between automated python XMPP server and interface to django? | 2,394,284 | <p>I have an XMPP server (likely â python, twisted, wokkel), which I prefer not to restart even in the development version, and I have some python module âworkerâ (which is interface to particular django project), which gets jid and message text and returns some response (text or XML, either way).</p>
<p>The que... | 0 | 2010-03-06T22:12:38Z | 2,394,510 | <p>I can't say that I understand all of your question, but the bit where you're asking how to connect django and twisted and multiple workers: I'd suggest using AMPQ. This gets you reliable message delivery, multiple consumers, persistence.</p>
<p>There's the txAMQP library for twisted.<br>
<a href="https://launchpad.... | 0 | 2010-03-06T23:38:41Z | [
"python",
"django"
] |
Best method of connection between automated python XMPP server and interface to django? | 2,394,284 | <p>I have an XMPP server (likely â python, twisted, wokkel), which I prefer not to restart even in the development version, and I have some python module âworkerâ (which is interface to particular django project), which gets jid and message text and returns some response (text or XML, either way).</p>
<p>The que... | 0 | 2010-03-06T22:12:38Z | 2,394,780 | <p>My suggestion is:</p>
<ol>
<li>Use RabbitMQ with XMPP adaptor.</li>
<li>Use Python <a href="http://ask.github.com/carrot/introduction.html" rel="nofollow">carrot</a> for AMQP since it can be used directly under Django.</li>
</ol>
| 1 | 2010-03-07T01:20:00Z | [
"python",
"django"
] |
how do i stop beautiful soup from skipping rows while parsing? | 2,394,300 | <p>while using beautifulsoup to parse a table in html every other row starts with</p>
<pre><code><tr class="row_k">
</code></pre>
<p>instead of a tr tag without a class</p>
<p>Sample HTML</p>
<pre><code><tr class="row_k">
<td><img src="some picture url" alt="Item A"></td>
<td>&... | 3 | 2010-03-06T22:19:05Z | 2,394,383 | <p>I am still learning a lot but I am going to suggest you try lxml. I am going to make a stab at this and I think it will mostly get you there but there may be some niceties I am not certain about.</p>
<p>assuming this1 is a string</p>
<pre><code>from lxml.html import fromstring
this1_tree=fromstring(this1)
all_cel... | 2 | 2010-03-06T22:54:59Z | [
"python",
"xml",
"tags",
"urllib2",
"beautifulsoup"
] |
Python mechanize ignores form input in the HTML | 2,394,420 | <p>Got my little mechanize code: </p>
<pre><code>br.open('http://tumblr.com/customize');
print br.response().read()
print br.form['edit_tumblelog[cname]'] # there definitely is edit_tumblelog
# and br.form['edit_tumblelog[enable_cname]'] works fine
</code></pre>
<p>Output:</p>
... | 1 | 2010-03-06T23:08:19Z | 2,394,678 | <p>Found the problem. It's a bug in Mechanize HTML parser that somehow ignores next tag after an occurence of <code><br/></code> note that <code><br /></code> works fine. My solution was to manually replace those:</p>
<pre><code>response = br.response()
response.set_data(response.get_data().replace("<br... | 7 | 2010-03-07T00:45:16Z | [
"python",
"mechanize"
] |
Python mechanize ignores form input in the HTML | 2,394,420 | <p>Got my little mechanize code: </p>
<pre><code>br.open('http://tumblr.com/customize');
print br.response().read()
print br.form['edit_tumblelog[cname]'] # there definitely is edit_tumblelog
# and br.form['edit_tumblelog[enable_cname]'] works fine
</code></pre>
<p>Output:</p>
... | 1 | 2010-03-06T23:08:19Z | 7,420,845 | <p>Maybe this is of interest for anyone:</p>
<pre><code>br=mechanize.Browser(factory=mechanize.RobustFactory())
</code></pre>
<p>This should resolve the problem with the HTML Parser.</p>
| 6 | 2011-09-14T18:01:02Z | [
"python",
"mechanize"
] |
Saving Django xml in a file? | 2,394,437 | <p>I have a function in a view that renders the xml in the browser, but what I want is to save the xml content to a file, to be used in a Flash gallery.</p>
<pre><code>def build_xml_menu(request):
rubros = Rubro.objects.all()
familias = Familia.objects.all()
context_data = {'rubros': rubros, 'familias'... | 2 | 2010-03-06T23:11:57Z | 2,394,454 | <p>You have to use <a href="http://docs.djangoproject.com/en/dev/ref/templates/api/#the-render-to-string-shortcut" rel="nofollow"><code>render to string</code></a> instead of <code>render_to_response</code> :)</p>
| 4 | 2010-03-06T23:18:29Z | [
"python",
"xml",
"django",
"flash"
] |
Get POSIX/Unix time in seconds and nanoseconds in Python? | 2,394,485 | <p>I've been trying to find a way to get the time since 1970-01-01 00:00:00 UTC in seconds and nanoseconds in python and I cannot find anything that will give me the proper precision.</p>
<p>I have tried using time module, but that precision is only to microseconds, so the code I tried was:</p>
<pre><code>import time... | 16 | 2010-03-06T23:30:36Z | 2,394,527 | <p>It is unlikely that you will actually get nanosecond precision from any current machine.</p>
<p>The machine can't create precision, and displaying significant digits where not appropriate is not The Right Thing To Do.</p>
| 5 | 2010-03-06T23:43:55Z | [
"python",
"time",
"posix"
] |
Get POSIX/Unix time in seconds and nanoseconds in Python? | 2,394,485 | <p>I've been trying to find a way to get the time since 1970-01-01 00:00:00 UTC in seconds and nanoseconds in python and I cannot find anything that will give me the proper precision.</p>
<p>I have tried using time module, but that precision is only to microseconds, so the code I tried was:</p>
<pre><code>import time... | 16 | 2010-03-06T23:30:36Z | 2,394,531 | <p>I don't think there's a platform-independent way (maybe some third party has coded one, but I can't find it) to get time in nanoseconds; you need to do it in a platform-specific way. For example, <a href="http://stackoverflow.com/questions/1205722/how-do-i-get-monotonic-time-durations-in-python">this SO question</a... | 2 | 2010-03-06T23:45:00Z | [
"python",
"time",
"posix"
] |
Get POSIX/Unix time in seconds and nanoseconds in Python? | 2,394,485 | <p>I've been trying to find a way to get the time since 1970-01-01 00:00:00 UTC in seconds and nanoseconds in python and I cannot find anything that will give me the proper precision.</p>
<p>I have tried using time module, but that precision is only to microseconds, so the code I tried was:</p>
<pre><code>import time... | 16 | 2010-03-06T23:30:36Z | 2,394,534 | <p>Your precision is just being lost due to string formatting:</p>
<pre><code>>>> import time
>>> print "%.20f" % time.time()
1267919090.35663390159606933594
</code></pre>
| 17 | 2010-03-06T23:45:36Z | [
"python",
"time",
"posix"
] |
Get POSIX/Unix time in seconds and nanoseconds in Python? | 2,394,485 | <p>I've been trying to find a way to get the time since 1970-01-01 00:00:00 UTC in seconds and nanoseconds in python and I cannot find anything that will give me the proper precision.</p>
<p>I have tried using time module, but that precision is only to microseconds, so the code I tried was:</p>
<pre><code>import time... | 16 | 2010-03-06T23:30:36Z | 2,394,540 | <p>The problem is probably related to your OS, not Python. See the documentation of the <code>time</code> module: <a href="http://docs.python.org/library/time.html" rel="nofollow">http://docs.python.org/library/time.html</a></p>
<blockquote>
<p><code>time.</code><strong><code>time()</code></strong></p>
<p>Retur... | 6 | 2010-03-06T23:46:44Z | [
"python",
"time",
"posix"
] |
Get POSIX/Unix time in seconds and nanoseconds in Python? | 2,394,485 | <p>I've been trying to find a way to get the time since 1970-01-01 00:00:00 UTC in seconds and nanoseconds in python and I cannot find anything that will give me the proper precision.</p>
<p>I have tried using time module, but that precision is only to microseconds, so the code I tried was:</p>
<pre><code>import time... | 16 | 2010-03-06T23:30:36Z | 38,454,199 | <p>It depends on the type of clock and your OS and hardware wether or not you can even get nanosecond precision <em>at all</em>. From the <a href="https://docs.python.org/3/library/time.html#time.get_clock_info" rel="nofollow"><code>time</code> module documentation</a>:</p>
<blockquote>
<p>The precision of the vario... | 0 | 2016-07-19T09:13:35Z | [
"python",
"time",
"posix"
] |
Migrating data from Plone to Liferay, or how could I retrieve information from Plone's Data.fs | 2,394,493 | <p>I need to migrate data from a Plone-based portal to Liferay. Has anyone some idea on how to do it?</p>
<p>Anyway, I am trying to retrieve data from Data.fs and store it in a representation easier to work, such as JSON. To do it, I need to know which objects I should get from Plone's Data.fs. I already got the <code... | 0 | 2010-03-06T23:33:25Z | 2,641,965 | <p>Once you've got ahold of the Plone site object, you can do a catalog query to find all content items in the site:</p>
<pre><code> >>> brains = site.portal_catalog.unrestrictedSearchResults()
</code></pre>
<p>This returns a list of "catalog brains", each of which contains some metadata about the item. You... | 2 | 2010-04-15T00:29:59Z | [
"python",
"liferay",
"plone",
"zope",
"zodb"
] |
How to split big numbers? | 2,394,698 | <p>I have a big number, which I need to split into smaller numbers in Python. I wrote the following code to swap between the two:</p>
<pre><code>
def split_number (num, part_size):
string = str(num)
string_size = len(string)
arr = []
pointer = 0
while pointer < string_size:
e = pointer... | 0 | 2010-03-07T00:54:41Z | 2,394,715 | <p>Clearly, any leading <code>0</code>s in the "parts" can't be preserved by this operation. Can't <code>join_number</code> also receive the <code>part_size</code> argument, so that it can reconstruct the string formats with all the leading zeros?</p>
<p>Without some information such as <code>part_size</code> that's ... | 2 | 2010-03-07T01:01:21Z | [
"python",
"string",
"numbers"
] |
How to split big numbers? | 2,394,698 | <p>I have a big number, which I need to split into smaller numbers in Python. I wrote the following code to swap between the two:</p>
<pre><code>
def split_number (num, part_size):
string = str(num)
string_size = len(string)
arr = []
pointer = 0
while pointer < string_size:
e = pointer... | 0 | 2010-03-07T00:54:41Z | 2,394,788 | <p>You should think of the following number split into 3-sized chunks:</p>
<pre><code>1000005 -> 100 000 5
</code></pre>
<p>You have two problems. The first is that if you put those <em>integers</em> back together, you'll get:</p>
<pre><code>100 0 5 -> 100005
</code></pre>
<p>(i.e., the middle one is 0, not 0... | 1 | 2010-03-07T01:22:08Z | [
"python",
"string",
"numbers"
] |
How to split big numbers? | 2,394,698 | <p>I have a big number, which I need to split into smaller numbers in Python. I wrote the following code to swap between the two:</p>
<pre><code>
def split_number (num, part_size):
string = str(num)
string_size = len(string)
arr = []
pointer = 0
while pointer < string_size:
e = pointer... | 0 | 2010-03-07T00:54:41Z | 2,395,036 | <p>There is no need to convert to and from strings, which can be very time consuming for really large numbers</p>
<pre><code>>>> def split_number(n, part_size):
... base = 10**part_size
... L = []
... while n:
... n,part = divmod(n,base)
... L.append(part)
... return L[::-1]
..... | 1 | 2010-03-07T03:20:34Z | [
"python",
"string",
"numbers"
] |
How to split big numbers? | 2,394,698 | <p>I have a big number, which I need to split into smaller numbers in Python. I wrote the following code to swap between the two:</p>
<pre><code>
def split_number (num, part_size):
string = str(num)
string_size = len(string)
arr = []
pointer = 0
while pointer < string_size:
e = pointer... | 0 | 2010-03-07T00:54:41Z | 2,396,538 | <p>Here's some code for Alex Martelli's answer.</p>
<pre><code>def digits(n, base):
while n:
yield n % base
n //= base
def split_number(n, part_size):
base = 10 ** part_size
return list(digits(n, base))
def join_number(digits, part_size):
base = 10 ** part_size
return sum(d * (bas... | 0 | 2010-03-07T14:17:39Z | [
"python",
"string",
"numbers"
] |
Elixir create_all() not creating database and tables | 2,394,743 | <p>Hey,
I'm using Elixir 0.7.1 , Sqlalchemy 0.6beta1 , MySQLdb 1.2.2.
My Model file 'model.py' looks like this:</p>
<pre><code>from elixir import *
from datetime import datetime
class Author:
first_name = Field(Unicode(64))
last_name = Field(Unicode(64))
class Article:
title = Field(Unicode(64))
class Catego... | 0 | 2010-03-07T01:08:32Z | 2,395,957 | <p>Well, you have to inherit from the Entity base class (or from another base class of your choosing that use the EntityMeta metaclass).</p>
<pre><code>class Author(Entity):
first_name = Field(Unicode(64))
last_name = Field(Unicode(64))
class Article(Entity):
title = Field(Unicode(64))
class Category(Ent... | 1 | 2010-03-07T10:42:35Z | [
"python",
"sqlalchemy",
"python-elixir"
] |
Aggregating across columns in Django | 2,394,778 | <p>I'm trying to figure out if there's a way to do a somewhat-complex aggregation in Django using its ORM, or if I'm going to have to use extra() to stick in some raw SQL.</p>
<p>Here are my object models (stripped to show just the essentials):</p>
<pre><code>class Submission(Models.model)
favorite_of = models.Many... | 1 | 2010-03-07T01:19:39Z | 2,395,252 | <p>One possibility would be to re-arrange your current query slightly. What if you tried something like the following:</p>
<pre><code>submission_list = Response.objects\
.annotate(votes=Count('voted_up_by'))\
.filter(votes__gt=0)\
.order_by('-votes')[:TOP_NUM]
submission_list.query.group_by = ['submission... | 1 | 2010-03-07T05:06:00Z | [
"python",
"django",
"orm",
"aggregate"
] |
Aggregating across columns in Django | 2,394,778 | <p>I'm trying to figure out if there's a way to do a somewhat-complex aggregation in Django using its ORM, or if I'm going to have to use extra() to stick in some raw SQL.</p>
<p>Here are my object models (stripped to show just the essentials):</p>
<pre><code>class Submission(Models.model)
favorite_of = models.Many... | 1 | 2010-03-07T01:19:39Z | 2,395,969 | <p>You can count favorites in another query like</p>
<pre><code>favorite_list = Submission.objects.annotate(favorites=Count(favorite_of))
</code></pre>
<p>After that you add the values from two lists:</p>
<pre><code>total_votes = {}
for item in submission_list:
total_votes[item.submission.id] = item.voted_by
for... | 0 | 2010-03-07T10:50:43Z | [
"python",
"django",
"orm",
"aggregate"
] |
Suppose I have 400 rows of people's names in a database. What's the best way to do a search for their names? | 2,394,870 | <p>They will also search part of their name. Not only words with spaces.
If they type "Matt", I expect to retrieve "Matthew" too.</p>
| 3 | 2010-03-07T01:54:54Z | 2,394,876 | <p>You can use:</p>
<pre><code>SELECT *
FROM mytable
WHERE name LIKE '%matt%'
</code></pre>
| 10 | 2010-03-07T01:57:55Z | [
"python",
"mysql",
"database",
"search",
"indexing"
] |
Suppose I have 400 rows of people's names in a database. What's the best way to do a search for their names? | 2,394,870 | <p>They will also search part of their name. Not only words with spaces.
If they type "Matt", I expect to retrieve "Matthew" too.</p>
| 3 | 2010-03-07T01:54:54Z | 2,394,891 | <p>You have the following options:</p>
<ol>
<li><a href="http://devzone.zend.com/article/1304" rel="nofollow">Full Text Search</a> (FTS)</li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/regexp.html" rel="nofollow">Regular Expressions</a></li>
<li><code>LIKE</code> Using wildcards</li>
</ol>
<p>...in that orde... | 1 | 2010-03-07T02:02:00Z | [
"python",
"mysql",
"database",
"search",
"indexing"
] |
Suppose I have 400 rows of people's names in a database. What's the best way to do a search for their names? | 2,394,870 | <p>They will also search part of their name. Not only words with spaces.
If they type "Matt", I expect to retrieve "Matthew" too.</p>
| 3 | 2010-03-07T01:54:54Z | 2,394,937 | <pre><code>SELECT *
FROM mytable
WHERE name LIKE 'matt%' OR name LIKE '[ ,-/]matt%'
</code></pre>
<p>Notes:<br>
1) <strong>Fancy wildcard.</strong> The reason for not using the simpler LIKE '%xyz%' form is that depending on the xyz the database could return many non-relevant records. For example "Jeff Zermatt" in ... | 12 | 2010-03-07T02:29:25Z | [
"python",
"mysql",
"database",
"search",
"indexing"
] |
Suppose I have 400 rows of people's names in a database. What's the best way to do a search for their names? | 2,394,870 | <p>They will also search part of their name. Not only words with spaces.
If they type "Matt", I expect to retrieve "Matthew" too.</p>
| 3 | 2010-03-07T01:54:54Z | 2,395,473 | <p>If you are trying to search for the names through any development Language, you can use the Regular expression package in Java.
Some thing like java.util.regex.*;</p>
| 0 | 2010-03-07T07:13:35Z | [
"python",
"mysql",
"database",
"search",
"indexing"
] |
Python _ctypes import error on OSX 10.6 | 2,394,903 | <p>I'm very new to Python development, and am having a problem with one of my apps in OSX.</p>
<p>Technologies being used in this project</p>
<ul>
<li>python 2.6</li>
<li>django</li>
<li>google app engine</li>
<li>rpx (openid)</li>
</ul>
<p>When loading up the site on my windows app, there are no issues, but when tr... | 3 | 2010-03-07T02:09:15Z | 2,394,908 | <p>The only thing that I can think of is that maybe it's not on your path. Seems unlikely, but I would check that anyways.</p>
| 0 | 2010-03-07T02:12:22Z | [
"python",
"osx"
] |
Python _ctypes import error on OSX 10.6 | 2,394,903 | <p>I'm very new to Python development, and am having a problem with one of my apps in OSX.</p>
<p>Technologies being used in this project</p>
<ul>
<li>python 2.6</li>
<li>django</li>
<li>google app engine</li>
<li>rpx (openid)</li>
</ul>
<p>When loading up the site on my windows app, there are no issues, but when tr... | 3 | 2010-03-07T02:09:15Z | 2,394,921 | <p>OS X 10.6's Python 2.6 does include ctypes by default. You can even see part of it in the error report. So if there's a problem with the installation, it's only a problem with <strong>part</strong> of ctypes. That suggests that either it was damaged somehow or that something else is interfering with some part of ... | 6 | 2010-03-07T02:20:22Z | [
"python",
"osx"
] |
Python _ctypes import error on OSX 10.6 | 2,394,903 | <p>I'm very new to Python development, and am having a problem with one of my apps in OSX.</p>
<p>Technologies being used in this project</p>
<ul>
<li>python 2.6</li>
<li>django</li>
<li>google app engine</li>
<li>rpx (openid)</li>
</ul>
<p>When loading up the site on my windows app, there are no issues, but when tr... | 3 | 2010-03-07T02:09:15Z | 4,402,758 | <p>I was using python 2.6.1 on my Mac OS X Snow Leopard 10.6.3.</p>
<p>Follow the steps bellow to solve this problem:</p>
<p>1) Download and install python 2.5.2: <a href="http://www.python.org/download/releases/2.5.2/" rel="nofollow">http://www.python.org/download/releases/2.5.2/</a></p>
<p>2) Run GoogleAppEngineLa... | 2 | 2010-12-09T20:22:28Z | [
"python",
"osx"
] |
Python _ctypes import error on OSX 10.6 | 2,394,903 | <p>I'm very new to Python development, and am having a problem with one of my apps in OSX.</p>
<p>Technologies being used in this project</p>
<ul>
<li>python 2.6</li>
<li>django</li>
<li>google app engine</li>
<li>rpx (openid)</li>
</ul>
<p>When loading up the site on my windows app, there are no issues, but when tr... | 3 | 2010-03-07T02:09:15Z | 4,802,082 | <p>I don't have enough rep to comment so I will make this a post.
The accepted answer is correct in that all you need to do is set the Python Path in the GAE preferences to /usr/bin/python2.5.</p>
<p>There is no need to download python 2.5 via macports or from the official python website.</p>
<p>python 2.5 is still i... | 3 | 2011-01-26T07:01:02Z | [
"python",
"osx"
] |
How do you NOT automatically dereference a db.ReferenceProperty in Google App Engine? | 2,395,144 | <p>Suppose I have</p>
<pre><code>class Foo(db.Model):
bar = db.ReferenceProperty(Bar)
foo = Foo.all().get()
</code></pre>
<p>Is there a way for me to do foo.bar without a query being made to Datastore? The docs say that <code>foo.bar</code> will be an instance of <code>Key</code>, so I would expect to be able to ... | 2 | 2010-03-07T04:05:34Z | 2,395,230 | <p>As <a href="http://code.google.com/appengine/docs/python/datastore/typesandpropertyclasses.html#ReferenceProperty" rel="nofollow">the docs</a> say,</p>
<blockquote>
<p>The ReferenceProperty value can be
used as if it were a model instance,
and the datastore entity will be
fetched and the model instance crea... | 8 | 2010-03-07T04:53:04Z | [
"python",
"google-app-engine",
"gae-datastore"
] |
Python Libraries and drivers | 2,395,157 | <p>I have no knowledge of Python. I started with .NET and than learned PHP. Someone later asked me to learn Ruby as well. I started learning it. Since last few months I am seeing many libraries and drivers written in Python. I want to know what are the advantages of Python over PHP/Ruby? What type of language it is and... | 1 | 2010-03-07T04:16:47Z | 2,395,204 | <p>Nobody can tell you the exact answer because everybody has their own "holy grail". You will just have to find out for yourself which one suits you best for the task you want to perform. Case closed.</p>
| 1 | 2010-03-07T04:38:31Z | [
"php",
"python",
"ruby"
] |
Python Libraries and drivers | 2,395,157 | <p>I have no knowledge of Python. I started with .NET and than learned PHP. Someone later asked me to learn Ruby as well. I started learning it. Since last few months I am seeing many libraries and drivers written in Python. I want to know what are the advantages of Python over PHP/Ruby? What type of language it is and... | 1 | 2010-03-07T04:16:47Z | 2,433,699 | <p>If you're just getting started in python, chances are the standard python distribution will work just fine. Once you get into the guts of your project, changing to IronPython (etc) is not a big deal.</p>
<p>I think the most important part is the "getting started" piece. Start writing python and you'll never look ba... | 1 | 2010-03-12T15:22:18Z | [
"php",
"python",
"ruby"
] |
What is the correct syntax for 'else if'? | 2,395,160 | <p>I'm a new Python programmer who is making the leap from 2.6.4 to 3.1.1. Everything has gone fine until I tried to use the 'else if' statement. The interpreter gives me a syntax error after the 'if' in 'else if' for a reason I can't seem to figure out.</p>
<pre><code>def function(a):
if a == '1':
print (... | 129 | 2010-03-07T04:17:47Z | 2,395,167 | <p>In python "else if" is spelled "elif".<br>
Also, you need a colon after the <code>elif</code> and the <code>else</code>.</p>
<p>Simple answer to a simple question. I had the same problem, when I first started (in the last couple of weeks).</p>
<p>So your code should read:</p>
<pre><code>def function(a):
if a ... | 219 | 2010-03-07T04:20:40Z | [
"python",
"python-3.x"
] |
What is the correct syntax for 'else if'? | 2,395,160 | <p>I'm a new Python programmer who is making the leap from 2.6.4 to 3.1.1. Everything has gone fine until I tried to use the 'else if' statement. The interpreter gives me a syntax error after the 'if' in 'else if' for a reason I can't seem to figure out.</p>
<pre><code>def function(a):
if a == '1':
print (... | 129 | 2010-03-07T04:17:47Z | 2,395,169 | <p>It looks like your missing some colons on the 'else if' and 'else' statements.</p>
| 0 | 2010-03-07T04:21:54Z | [
"python",
"python-3.x"
] |
What is the correct syntax for 'else if'? | 2,395,160 | <p>I'm a new Python programmer who is making the leap from 2.6.4 to 3.1.1. Everything has gone fine until I tried to use the 'else if' statement. The interpreter gives me a syntax error after the 'if' in 'else if' for a reason I can't seem to figure out.</p>
<pre><code>def function(a):
if a == '1':
print (... | 129 | 2010-03-07T04:17:47Z | 2,395,172 | <p>Do you mean <a href="http://docs.python.org/3.1/tutorial/controlflow.html"><code>elif</code></a>?</p>
| 9 | 2010-03-07T04:23:10Z | [
"python",
"python-3.x"
] |
What is the correct syntax for 'else if'? | 2,395,160 | <p>I'm a new Python programmer who is making the leap from 2.6.4 to 3.1.1. Everything has gone fine until I tried to use the 'else if' statement. The interpreter gives me a syntax error after the 'if' in 'else if' for a reason I can't seem to figure out.</p>
<pre><code>def function(a):
if a == '1':
print (... | 129 | 2010-03-07T04:17:47Z | 2,395,173 | <pre><code>def function(a):
if a == '1':
print ('1a')
elif a == '2':
print ('2a')
else:
print ('3a')
</code></pre>
| 6 | 2010-03-07T04:23:42Z | [
"python",
"python-3.x"
] |
What is the correct syntax for 'else if'? | 2,395,160 | <p>I'm a new Python programmer who is making the leap from 2.6.4 to 3.1.1. Everything has gone fine until I tried to use the 'else if' statement. The interpreter gives me a syntax error after the 'if' in 'else if' for a reason I can't seem to figure out.</p>
<pre><code>def function(a):
if a == '1':
print (... | 129 | 2010-03-07T04:17:47Z | 2,395,189 | <p>since olden times, the correct syntax for <code>if/else if</code> in Python is <code>elif</code>. By the way, you can use dictionary if you have alot of <code>if/else</code>.eg </p>
<pre><code>d={"1":"1a","2":"2a"}
if not a in d: print("3a")
else: print (d[a])
</code></pre>
<p>For msw, example of executing functio... | 5 | 2010-03-07T04:31:01Z | [
"python",
"python-3.x"
] |
What is the correct syntax for 'else if'? | 2,395,160 | <p>I'm a new Python programmer who is making the leap from 2.6.4 to 3.1.1. Everything has gone fine until I tried to use the 'else if' statement. The interpreter gives me a syntax error after the 'if' in 'else if' for a reason I can't seem to figure out.</p>
<pre><code>def function(a):
if a == '1':
print (... | 129 | 2010-03-07T04:17:47Z | 2,395,288 | <p>Here is a little refactoring of your function (it does not use "else" or "elif"):</p>
<pre><code>def function(a):
if a not in (1, 2):
a = 3
print(str(a) + "a")
</code></pre>
<p>@ghostdog74: Python 3 requires parentheses for "print".</p>
| 2 | 2010-03-07T05:26:17Z | [
"python",
"python-3.x"
] |
What is the correct syntax for 'else if'? | 2,395,160 | <p>I'm a new Python programmer who is making the leap from 2.6.4 to 3.1.1. Everything has gone fine until I tried to use the 'else if' statement. The interpreter gives me a syntax error after the 'if' in 'else if' for a reason I can't seem to figure out.</p>
<pre><code>def function(a):
if a == '1':
print (... | 129 | 2010-03-07T04:17:47Z | 29,065,811 | <p><strong>Python 3.x has had some changes, which means some python2.7 programs may not work.</strong></p>
<p><em>I know this answer may be be late but it points some things out.</em></p>
<p>Python 3.x's equivalent of <code>else if</code> has been shrunk to <code>elif</code>.
This means all <code>else if</code> code ... | -1 | 2015-03-15T20:27:34Z | [
"python",
"python-3.x"
] |
How do I set up QtDesigner for a project that has animated elements? | 2,395,232 | <p>I'm writing a project to simulate creatures moving around a map. These can be represented by simple circles, but I need a map/grid and those circles animated on top of the map. </p>
<p>What elements should I use in QtDesigner to set up for this kind of GUI in my project? I've yet to do anything like this before<... | 1 | 2010-03-07T04:53:30Z | 2,395,301 | <p>You probably want a <a href="http://doc.trolltech.com/4.6/qgraphicsview.html" rel="nofollow">Graphics View</a> to do it right, but if you don't care about performance, you might be able to get by with just setting the pos on a bunch of buttons to move them around on a widget (without a layout).</p>
| 1 | 2010-03-07T05:30:46Z | [
"python",
"user-interface",
"qt",
"animation",
"pyqt"
] |
Using Tkinter in python to edit the title bar | 2,395,431 | <p>I am trying to add a custom title to a window but I am having troubles with it. I know my code isn't right but when I run it, it creates 2 windows instead, one with just the title tk and another bigger window with "Simple Prog". How do I make it so that the tk window has the title "Simple Prog" instead of having a n... | 26 | 2010-03-07T06:50:21Z | 2,395,649 | <p>self.parent is a reference to the actual window, so self.root.title should be self.parent.title, and self.root shouldn't exist.</p>
| 0 | 2010-03-07T08:36:54Z | [
"python",
"tkinter",
"titlebar"
] |
Using Tkinter in python to edit the title bar | 2,395,431 | <p>I am trying to add a custom title to a window but I am having troubles with it. I know my code isn't right but when I run it, it creates 2 windows instead, one with just the title tk and another bigger window with "Simple Prog". How do I make it so that the tk window has the title "Simple Prog" instead of having a n... | 26 | 2010-03-07T06:50:21Z | 2,398,906 | <p>Tkinter automatically creates a window for you -- the one created when you call Tk(). I'm not sure why you're seeing two windows with the code you posted. Typically that means you're creating a toplevel window at some point in your code.</p>
<p>Try this:</p>
<pre><code>from Tkinter import Tk
root = Tk()
root.wm_ti... | 46 | 2010-03-08T02:06:21Z | [
"python",
"tkinter",
"titlebar"
] |
Using Tkinter in python to edit the title bar | 2,395,431 | <p>I am trying to add a custom title to a window but I am having troubles with it. I know my code isn't right but when I run it, it creates 2 windows instead, one with just the title tk and another bigger window with "Simple Prog". How do I make it so that the tk window has the title "Simple Prog" instead of having a n... | 26 | 2010-03-07T06:50:21Z | 2,425,236 | <p>Try something like:</p>
<pre class="lang-python prettyprint-override"><code>from tkinter import Tk, Button, Frame, Entry, END
class ABC(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
root = Tk()
app = ABC(master=root)
app.master.title("Simple Prog")
a... | 3 | 2010-03-11T13:30:18Z | [
"python",
"tkinter",
"titlebar"
] |
Using Tkinter in python to edit the title bar | 2,395,431 | <p>I am trying to add a custom title to a window but I am having troubles with it. I know my code isn't right but when I run it, it creates 2 windows instead, one with just the title tk and another bigger window with "Simple Prog". How do I make it so that the tk window has the title "Simple Prog" instead of having a n... | 26 | 2010-03-07T06:50:21Z | 14,075,200 | <p>Having just done this myself you can do it this way:</p>
<pre><code>from tkinter import Tk, Button, Frame, Entry, END
class ABC(Frame):
def __init__(self, parent=None):
Frame.__init__(self, parent)
self.parent = parent
self.pack()
ABC.make_widgets(self)
def make_widgets(sel... | 1 | 2012-12-28T20:14:14Z | [
"python",
"tkinter",
"titlebar"
] |
Using Tkinter in python to edit the title bar | 2,395,431 | <p>I am trying to add a custom title to a window but I am having troubles with it. I know my code isn't right but when I run it, it creates 2 windows instead, one with just the title tk and another bigger window with "Simple Prog". How do I make it so that the tk window has the title "Simple Prog" instead of having a n... | 26 | 2010-03-07T06:50:21Z | 39,087,198 | <p>For anybody who runs into the issue of having two windows open, and runs across this question. Here is how I stumbled upon a solution.</p>
<p>The reason the code in this question is producing two windows is because </p>
<pre><code>Frame.__init__(self, parent)
</code></pre>
<p>is being run before </p>
<pre><code>... | 0 | 2016-08-22T19:20:37Z | [
"python",
"tkinter",
"titlebar"
] |
Sending gzipped form data | 2,395,440 | <p>I've heard how browsers can receive gzipped pages from the server. Can they also gzip form data that they send to the server? And if it's possible, how would I decompress this data on the server?</p>
<p>I'm using AppEngine's webapp module, but a general explanation / pointers to tutorials would be sufficient. I've ... | 4 | 2010-03-07T06:55:27Z | 2,395,471 | <p>I think that browsers probably can send gzipped form data to the server. I don't know if it is common to do so or not.</p>
<p>The sender would need to make sure to have a <code>Content-Encoding:</code> header with a value that included <code>gzip</code>. The body of the message would then need to be encoded with a ... | 4 | 2010-03-07T07:13:28Z | [
"python",
"google-app-engine",
"forms",
"gzip"
] |
Sending gzipped form data | 2,395,440 | <p>I've heard how browsers can receive gzipped pages from the server. Can they also gzip form data that they send to the server? And if it's possible, how would I decompress this data on the server?</p>
<p>I'm using AppEngine's webapp module, but a general explanation / pointers to tutorials would be sufficient. I've ... | 4 | 2010-03-07T06:55:27Z | 2,397,242 | <p>Short answer: No.</p>
<p>See: <a href="http://stackoverflow.com/questions/424917/why-cant-browser-send-gzip-request">http://stackoverflow.com/questions/424917/why-cant-browser-send-gzip-request</a></p>
| 4 | 2010-03-07T17:55:44Z | [
"python",
"google-app-engine",
"forms",
"gzip"
] |
Sending gzipped form data | 2,395,440 | <p>I've heard how browsers can receive gzipped pages from the server. Can they also gzip form data that they send to the server? And if it's possible, how would I decompress this data on the server?</p>
<p>I'm using AppEngine's webapp module, but a general explanation / pointers to tutorials would be sufficient. I've ... | 4 | 2010-03-07T06:55:27Z | 11,323,947 | <p><strong>Short answer:</strong></p>
<p>No, most browsers will not compress form data for client requests.</p>
<p><strong>Long answer:</strong></p>
<p>Yes, all browsers allow the client to send compressed form data. But since the browsers wouldn't compress the data for us, we've got to compress it ourselves.</p>
<... | 4 | 2012-07-04T06:59:29Z | [
"python",
"google-app-engine",
"forms",
"gzip"
] |
algorithm to find independent sets | 2,395,525 | <p>Folks,
I have a problem. I am a writing a script in python which consists of several modules. Some of the modules are dependent on other modules, hence they should be run only after the dependent modules are successfully run. So each modules derives from a base class module and overrides a list called DEPENDENCIES w... | 1 | 2010-03-07T07:35:45Z | 2,395,557 | <p>I posted a description of <a href="http://en.wikipedia.org/wiki/Topological_sorting" rel="nofollow">topological sorting</a> recently <a href="http://stackoverflow.com/questions/2367284/how-does-the-make-j-option-actually-work/2367370#2367370">in a question about <code>make -j</code></a>. Serendipity! From the Wikipe... | 2 | 2010-03-07T07:55:59Z | [
"python",
"algorithm",
"data-structures"
] |
algorithm to find independent sets | 2,395,525 | <p>Folks,
I have a problem. I am a writing a script in python which consists of several modules. Some of the modules are dependent on other modules, hence they should be run only after the dependent modules are successfully run. So each modules derives from a base class module and overrides a list called DEPENDENCIES w... | 1 | 2010-03-07T07:35:45Z | 2,395,628 | <p>From your setting description you can also do it directly.</p>
<p>It looks like every modules known it's dependencies. Then adding a predicate function in every module stating if it can run is simple enough. A module can be run if and only if all of it's prerequisites dependencies are satisfied. </p>
<p>Top level ... | 1 | 2010-03-07T08:23:23Z | [
"python",
"algorithm",
"data-structures"
] |
Detect workstation/System Screen Lock using Python(ubuntu) | 2,395,579 | <p>Is there anyway that we can detect when the system/screen gets locked and notify some event to trigger in Ubuntu ?</p>
| 2 | 2010-03-07T08:05:26Z | 2,395,608 | <p>There is a possibility to be notified when the screen becomes locked/unlocked with DBus, this is reference on <a href="http://live.gnome.org/GnomeScreensaver/FrequentlyAskedQuestions#Is_there_a_way_to_perform_actions_when_the_screensaver_activates_or_deactivates.3F__Or_when_the_session_becomes_idle.3F" rel="nofollow... | 3 | 2010-03-07T08:16:37Z | [
"python",
"ubuntu",
"system",
"locking",
"kubuntu"
] |
python web framework for webmail service | 2,395,585 | <p>I'm planning to write a webmail service in Python but I can't decide which framework to choose. What criteria should I look into when trying to decide which framework to use ?</p>
| 1 | 2010-03-07T08:08:12Z | 2,395,622 | <ul>
<li><p>Model View Controller separation is a nice one, though standard with most frameworks. It greatly improves code readability, separation of tasks, testability, optimization later on, and maintainability in the future.</p></li>
<li><p>The ability to utilize a templating language of your choice. This allows y... | 0 | 2010-03-07T08:21:05Z | [
"python",
"frameworks",
"webmail"
] |
python web framework for webmail service | 2,395,585 | <p>I'm planning to write a webmail service in Python but I can't decide which framework to choose. What criteria should I look into when trying to decide which framework to use ?</p>
| 1 | 2010-03-07T08:08:12Z | 2,529,913 | <p>I'd like to add that you might want to look at posterity (http://posterity.edgewall.org/). Even though the project is basically abandoned, I guess there is at least some interesting code.</p>
| 0 | 2010-03-27T15:58:37Z | [
"python",
"frameworks",
"webmail"
] |
python web framework for webmail service | 2,395,585 | <p>I'm planning to write a webmail service in Python but I can't decide which framework to choose. What criteria should I look into when trying to decide which framework to use ?</p>
| 1 | 2010-03-07T08:08:12Z | 2,545,666 | <p>I know you're asking about which web framework but this might be very useful to you. Lamson is a framework for dealing with email, it lets you basically write your own mail server and do all sorts of useful stuff in Python, check it out here <a href="http://lamsonproject.org/" rel="nofollow">http://lamsonproject.org... | 2 | 2010-03-30T13:45:38Z | [
"python",
"frameworks",
"webmail"
] |
using os.path is quite verbose is there a more concise way to manipulate paths | 2,395,653 | <p>for example I have a script that needs to put it's parent directory on the python path, currently I'm using the following</p>
<pre><code>sys.path += [os.path.dirname(os.path.dirname(os.path.realpath(__file__)))]
</code></pre>
<p>this seems a touch ridiculous, surely there is a simpler way?</p>
| 3 | 2010-03-07T08:37:59Z | 2,395,669 | <p>You could do:</p>
<pre><code>from os.path import dirname,realpath
sys.path.append(dirname(dirname(realpath(__file__))))
</code></pre>
<p>But to be honest, I prefer the full explicit version. It's much easier to read as a standalone statement.</p>
| 1 | 2010-03-07T08:45:57Z | [
"python",
"path"
] |
using os.path is quite verbose is there a more concise way to manipulate paths | 2,395,653 | <p>for example I have a script that needs to put it's parent directory on the python path, currently I'm using the following</p>
<pre><code>sys.path += [os.path.dirname(os.path.dirname(os.path.realpath(__file__)))]
</code></pre>
<p>this seems a touch ridiculous, surely there is a simpler way?</p>
| 3 | 2010-03-07T08:37:59Z | 2,395,705 | <p>you can also do this</p>
<pre><code>>>> from os.path import dirname as dn, realpath as rp
</code></pre>
<p>but its still better to explicitly define the name so you won't have variable names collision problems.</p>
| 1 | 2010-03-07T09:00:33Z | [
"python",
"path"
] |
using os.path is quite verbose is there a more concise way to manipulate paths | 2,395,653 | <p>for example I have a script that needs to put it's parent directory on the python path, currently I'm using the following</p>
<pre><code>sys.path += [os.path.dirname(os.path.dirname(os.path.realpath(__file__)))]
</code></pre>
<p>this seems a touch ridiculous, surely there is a simpler way?</p>
| 3 | 2010-03-07T08:37:59Z | 2,396,224 | <p>Another option is to import path from os. It's not the <em>most consise</em> but I think it's still easy to read. Do you really want us to golf it? :)</p>
<pre><code>from os import path
sys.path += [path.dirname(path.dirname(path.realpath(__file__)))]
</code></pre>
| 0 | 2010-03-07T12:35:43Z | [
"python",
"path"
] |
using os.path is quite verbose is there a more concise way to manipulate paths | 2,395,653 | <p>for example I have a script that needs to put it's parent directory on the python path, currently I'm using the following</p>
<pre><code>sys.path += [os.path.dirname(os.path.dirname(os.path.realpath(__file__)))]
</code></pre>
<p>this seems a touch ridiculous, surely there is a simpler way?</p>
| 3 | 2010-03-07T08:37:59Z | 2,397,342 | <p>If it is a huge problem, you could wrap os.path functionality is a path class. I'm pretty sure there is a Path module floating around on the internet.</p>
| 0 | 2010-03-07T18:23:10Z | [
"python",
"path"
] |
using os.path is quite verbose is there a more concise way to manipulate paths | 2,395,653 | <p>for example I have a script that needs to put it's parent directory on the python path, currently I'm using the following</p>
<pre><code>sys.path += [os.path.dirname(os.path.dirname(os.path.realpath(__file__)))]
</code></pre>
<p>this seems a touch ridiculous, surely there is a simpler way?</p>
| 3 | 2010-03-07T08:37:59Z | 2,397,372 | <p>I've found <a href="http://pypi.python.org/pypi/path.py" rel="nofollow">Jason Orendorff's path module</a> to be very nice. Unfortunately, it seems that his website is no longer on the internet, but you can still <a href="http://pypi.python.org/packages/source/p/path.py/path-2.2.zip" rel="nofollow">download the modu... | 2 | 2010-03-07T18:30:06Z | [
"python",
"path"
] |
Whoosh index viewer | 2,395,675 | <p>I'm using haystack with whoosh as backend for a Django app.</p>
<p>Is there any way to view the content (in a easy to read format) of the indexes generated by whoosh? I'd like to see what data was indexed and how so I can better understand how it works.</p>
| 11 | 2010-03-07T08:48:38Z | 5,296,975 | <p>You can do this pretty easily from python's interactive console:</p>
<pre><code>>>> from whoosh.index import open_dir
>>> ix = open_dir('whoosh_index')
>>> ix.schema
<<< <Schema: ['author', 'author_exact', 'content', 'django_ct', 'django_id', 'id', 'lexer', 'lexer_exact', 'pub... | 10 | 2011-03-14T09:46:48Z | [
"python",
"django-haystack",
"whoosh"
] |
Whoosh index viewer | 2,395,675 | <p>I'm using haystack with whoosh as backend for a Django app.</p>
<p>Is there any way to view the content (in a easy to read format) of the indexes generated by whoosh? I'd like to see what data was indexed and how so I can better understand how it works.</p>
| 11 | 2010-03-07T08:48:38Z | 13,022,937 | <pre><code>from whoosh.index import open_dir
ix = open_dir('whoosh_index')
ix.searcher().documents() # will show all documents in the index.
</code></pre>
| 5 | 2012-10-23T03:00:10Z | [
"python",
"django-haystack",
"whoosh"
] |
Why time.clock() returns such a large value on Windows Server 2008 X64 | 2,395,677 | <p>I ran following script on different machine and got quite different results. The elapsed time.clock() is so large. </p>
<p>Script:</p>
<pre><code>#------------------------------------------------------------------------------------
import time
start_clock = time.clock()
time.sleep(60)
end_clock = time.clock()
prin... | 2 | 2010-03-07T08:49:01Z | 2,397,457 | <p>Per <a href="http://docs.python.org/library/time.html?highlight=time.clock#time.clock" rel="nofollow">the docs</a> on <code>time.clock</code></p>
<blockquote>
<p>On Windows, this function returns
wall-clock seconds elapsed since the
first call to this function, as a floating point number, based on the Win32 f... | 2 | 2010-03-07T18:48:29Z | [
"python",
"time"
] |
how to load data and store the data from a file using numpy | 2,395,685 | <p>I have the following file like this:</p>
<pre><code>2 qid:1 1:0.32 2:0.50 3:0.78 4:0.02 10:0.90
5 qid:2 2:0.22 5:0.34 6:0.87 10:0.56 12:0.32 19:0.24 20:0.55
...
</code></pre>
<p>he structure is follwoing like that: </p>
<p>output={}
rel=2
qid=1
features={} # the feature list "1:0.32 2:0.50 3:0.78 4:0.02 10:0.9... | 0 | 2010-03-07T08:52:21Z | 2,396,564 | <p>For reading use something like this (data is in file 'fname'):</p>
<pre><code>f = open(fname)
lines = f.readlines(f)
for line in lines:
elements = line.split(' ')
rel = int(elements[0])
qid = int(elements[1].split(':')[1])
featurelist = elements[2:]
# get the various features again with splittin... | 1 | 2010-03-07T14:26:30Z | [
"python",
"parsing",
"numpy"
] |
how to load data and store the data from a file using numpy | 2,395,685 | <p>I have the following file like this:</p>
<pre><code>2 qid:1 1:0.32 2:0.50 3:0.78 4:0.02 10:0.90
5 qid:2 2:0.22 5:0.34 6:0.87 10:0.56 12:0.32 19:0.24 20:0.55
...
</code></pre>
<p>he structure is follwoing like that: </p>
<p>output={}
rel=2
qid=1
features={} # the feature list "1:0.32 2:0.50 3:0.78 4:0.02 10:0.9... | 0 | 2010-03-07T08:52:21Z | 17,740,164 | <p>The following should work nicely and leaves your data in a handy format:</p>
<pre><code>regexp = r"(\d+)\s+qid:(\d+)\s+(.+)"
data = np.fromregex(file_name, regexp,
dtype=[('rel', int), ('qid', int), ('features', object)])
</code></pre>
<p>From here you can select rel, qid or features by callin... | 0 | 2013-07-19T07:15:22Z | [
"python",
"parsing",
"numpy"
] |
how to load data and store the data from a file using numpy | 2,395,685 | <p>I have the following file like this:</p>
<pre><code>2 qid:1 1:0.32 2:0.50 3:0.78 4:0.02 10:0.90
5 qid:2 2:0.22 5:0.34 6:0.87 10:0.56 12:0.32 19:0.24 20:0.55
...
</code></pre>
<p>he structure is follwoing like that: </p>
<p>output={}
rel=2
qid=1
features={} # the feature list "1:0.32 2:0.50 3:0.78 4:0.02 10:0.9... | 0 | 2010-03-07T08:52:21Z | 18,499,103 | <p>It looks like your input files are in svmlight format. If this is true, then there's a parser included as part of scikit-learn that might be handy to use -- see the source at:</p>
<p><a href="https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/datasets/svmlight_format.py#L32" rel="nofollow">https://git... | 0 | 2013-08-28T22:10:54Z | [
"python",
"parsing",
"numpy"
] |
Python: startswith any alpha character | 2,395,821 | <p>How can I use the startswith function to match any alpha character [a-zA-Z]. For example I would like to do this:</p>
<pre><code>if line.startswith(ALPHA):
Do Something
</code></pre>
| 8 | 2010-03-07T09:49:34Z | 2,395,836 | <p>An easy solution would be to use the python regex module:</p>
<pre><code>import re
if re.match("^[a-zA-Z]+.*", line):
Do Something
</code></pre>
| 2 | 2010-03-07T09:56:30Z | [
"python",
"startswith"
] |
Python: startswith any alpha character | 2,395,821 | <p>How can I use the startswith function to match any alpha character [a-zA-Z]. For example I would like to do this:</p>
<pre><code>if line.startswith(ALPHA):
Do Something
</code></pre>
| 8 | 2010-03-07T09:49:34Z | 2,395,858 | <p>You can pass a tuple to <code>startswiths()</code> (in Python 2.5+) to match any of its elements:</p>
<pre><code>import string
ALPHA = string.ascii_letters
if line.startswith(tuple(ALPHA)):
pass
</code></pre>
<p>Of course, for this simple case, a regex test or the <code>in</code> operator would be more readabl... | 6 | 2010-03-07T10:03:03Z | [
"python",
"startswith"
] |
Python: startswith any alpha character | 2,395,821 | <p>How can I use the startswith function to match any alpha character [a-zA-Z]. For example I would like to do this:</p>
<pre><code>if line.startswith(ALPHA):
Do Something
</code></pre>
| 8 | 2010-03-07T09:49:34Z | 2,395,874 | <p>This is probably the most efficient method:</p>
<pre><code>if line != "" and line[0].isalpha():
...
</code></pre>
| 2 | 2010-03-07T10:08:35Z | [
"python",
"startswith"
] |
Python: startswith any alpha character | 2,395,821 | <p>How can I use the startswith function to match any alpha character [a-zA-Z]. For example I would like to do this:</p>
<pre><code>if line.startswith(ALPHA):
Do Something
</code></pre>
| 8 | 2010-03-07T09:49:34Z | 2,395,875 | <p>If you want to match non-ASCII letters as well, you can do:</p>
<pre><code>if line and line[0].isalpha():
</code></pre>
| 28 | 2010-03-07T10:08:43Z | [
"python",
"startswith"
] |
Python: startswith any alpha character | 2,395,821 | <p>How can I use the startswith function to match any alpha character [a-zA-Z]. For example I would like to do this:</p>
<pre><code>if line.startswith(ALPHA):
Do Something
</code></pre>
| 8 | 2010-03-07T09:49:34Z | 2,396,046 | <p>if you don't care about blanks in front of the string, </p>
<pre><code>if line and line.lstrip()[0].isalpha():
</code></pre>
| -1 | 2010-03-07T11:20:44Z | [
"python",
"startswith"
] |
Python: startswith any alpha character | 2,395,821 | <p>How can I use the startswith function to match any alpha character [a-zA-Z]. For example I would like to do this:</p>
<pre><code>if line.startswith(ALPHA):
Do Something
</code></pre>
| 8 | 2010-03-07T09:49:34Z | 7,366,605 | <pre><code>if line.startswith((chr(x) for x in range(ord('a'), ord('z')+1)+range(ord('A'), ord('Z')+1)):
# do processsing
pass
</code></pre>
| 0 | 2011-09-09T19:37:25Z | [
"python",
"startswith"
] |
storing app settings on Google App Engine | 2,396,101 | <p>I need to store settings for my Google App Engine project. Currently I have:</p>
<pre><code>class Settings(db.Model):
rate = db.IntegerProperty(default=4)
...
</code></pre>
<p>And when I want to use it:</p>
<pre><code>Settings.get_or_insert('settings')
</code></pre>
<p>This feels clumsy so is there a bet... | 5 | 2010-03-07T11:40:05Z | 2,397,363 | <p>Please clarify what does "feel clumsy" to you about this -- that's not very clear to me.</p>
<p>The datastore is <em>the</em> way to persist updatable data in App Engine (blobstore's for huge blobs, memcache's not guaranteed persistent). If your settings can't be changed by the application of course you can just pu... | 4 | 2010-03-07T18:27:37Z | [
"python",
"google-app-engine",
"settings"
] |
storing app settings on Google App Engine | 2,396,101 | <p>I need to store settings for my Google App Engine project. Currently I have:</p>
<pre><code>class Settings(db.Model):
rate = db.IntegerProperty(default=4)
...
</code></pre>
<p>And when I want to use it:</p>
<pre><code>Settings.get_or_insert('settings')
</code></pre>
<p>This feels clumsy so is there a bet... | 5 | 2010-03-07T11:40:05Z | 35,261,032 | <p>In my projects, I put config data in the datastore (one record per config value) using this class:</p>
<pre><code>from google.appengine.ext import ndb
class Settings(ndb.Model):
name = ndb.StringProperty()
value = ndb.StringProperty()
@staticmethod
def get(name):
NOT_SET_VALUE = "NOT SET"
retval =... | 0 | 2016-02-08T00:51:18Z | [
"python",
"google-app-engine",
"settings"
] |
how to document a python package | 2,396,141 | <p>I know what's the standard way to document functions, classes and modules, but how do I document packages - do I put a docstring in <code>__init__.py</code>, or something else?</p>
| 10 | 2010-03-07T11:54:49Z | 2,396,158 | <p>Yes, just like for a function or class comment, the first item in the <strong>__init__.py</strong> file should be a comment string:</p>
<pre><code>"""
This is the xyz package.
"""
</code></pre>
<p>Now if you import the package, and use help(package), you will see your docstring. See more here: <a href="http://www.... | 13 | 2010-03-07T12:04:15Z | [
"python",
"documentation",
"package"
] |
how to document a python package | 2,396,141 | <p>I know what's the standard way to document functions, classes and modules, but how do I document packages - do I put a docstring in <code>__init__.py</code>, or something else?</p>
| 10 | 2010-03-07T11:54:49Z | 2,396,161 | <p>See <a href="http://www.python.org/dev/peps/pep-0257/" rel="nofollow">PEP257</a></p>
<blockquote>
<p>A package may be documented in the module docstring of the __ init __.py file in the package directory.</p>
</blockquote>
| 3 | 2010-03-07T12:04:41Z | [
"python",
"documentation",
"package"
] |
how to document a python package | 2,396,141 | <p>I know what's the standard way to document functions, classes and modules, but how do I document packages - do I put a docstring in <code>__init__.py</code>, or something else?</p>
| 10 | 2010-03-07T11:54:49Z | 2,396,556 | <p>Documenting is a good idea, so long as you don't document something obvious in your code</p>
<p>Try to understand that most people reading your source will understand python, so commenting or documenting lines like this is pointless:</p>
<pre><code>a = 1 #this assigns 1 to a
</code></pre>
<p>But commenting or... | -3 | 2010-03-07T14:22:57Z | [
"python",
"documentation",
"package"
] |
Best seed for parallel process | 2,396,209 | <p>I need to run a MonteCarlo simulations in parallel on different machines. The code is in c++, but the program is set up and launched with a python script that set a lot of things, in particular the random seed. The function setseed thake a 4 bytes unsigned integer</p>
<p>Using a simple</p>
<pre><code>import time
s... | 4 | 2010-03-07T12:30:28Z | 2,396,277 | <p>Reading from <code>/dev/random</code> is a good idea. Just convert the 4 byte string into an Integer:</p>
<pre><code>f = open("/dev/random","rb")
rnd_str = f.read(4)
</code></pre>
<p>Either using struct:</p>
<pre><code>import struct
rand_int = struct.unpack('I', rnd_string)[0]
</code></pre>
<p><strong>Update</st... | 5 | 2010-03-07T12:48:40Z | [
"python",
"random",
"parallel-processing",
"seed",
"montecarlo"
] |
Best seed for parallel process | 2,396,209 | <p>I need to run a MonteCarlo simulations in parallel on different machines. The code is in c++, but the program is set up and launched with a python script that set a lot of things, in particular the random seed. The function setseed thake a 4 bytes unsigned integer</p>
<p>Using a simple</p>
<pre><code>import time
s... | 4 | 2010-03-07T12:30:28Z | 2,396,279 | <p>You could simply copy over the four bytes into an integer, that should be the least of your worries.</p>
<p>But parallel pseudo-random number generation is a rather complex topic and very often not done well. Usually you generate seeds on one machine and distribute them to the others.</p>
<p>Take a look at <a href... | 2 | 2010-03-07T12:49:11Z | [
"python",
"random",
"parallel-processing",
"seed",
"montecarlo"
] |
Best seed for parallel process | 2,396,209 | <p>I need to run a MonteCarlo simulations in parallel on different machines. The code is in c++, but the program is set up and launched with a python script that set a lot of things, in particular the random seed. The function setseed thake a 4 bytes unsigned integer</p>
<p>Using a simple</p>
<pre><code>import time
s... | 4 | 2010-03-07T12:30:28Z | 2,397,896 | <p>You can use a random number as the seed, which has the advantage of being operating-system agnostic (no /dev/random needed), with no conversion from string to int:</p>
<p>Why not simply use</p>
<pre><code>random.randrange(-2**31, 2**31)
</code></pre>
<p>as the seed of each process? Slightly different starting ti... | 0 | 2010-03-07T20:44:27Z | [
"python",
"random",
"parallel-processing",
"seed",
"montecarlo"
] |
Best seed for parallel process | 2,396,209 | <p>I need to run a MonteCarlo simulations in parallel on different machines. The code is in c++, but the program is set up and launched with a python script that set a lot of things, in particular the random seed. The function setseed thake a 4 bytes unsigned integer</p>
<p>Using a simple</p>
<pre><code>import time
s... | 4 | 2010-03-07T12:30:28Z | 2,398,053 | <p>If this is Linux or a similar OS, you want <code>/dev/urandom</code> -- it always produces data immediately.</p>
<p><code>/dev/random</code> may stall waiting for the system to gather randomness. It does produce cryptographic-grade random numbers, but that is overkill for your problem.</p>
| 1 | 2010-03-07T21:34:09Z | [
"python",
"random",
"parallel-processing",
"seed",
"montecarlo"
] |
Memory error due to the huge input file size | 2,396,238 | <p>When I using the following code to read file:</p>
<pre><code>lines=file("data.txt").read().split("\n")
</code></pre>
<p>I have the following error</p>
<pre><code>MemoryError
</code></pre>
<p>the file size is</p>
<pre><code>ls -l
-rw-r--r-- 1 charlie charlie 1258467201 Sep 26 12:57 data.txt
</code></pre>
| 1 | 2010-03-07T12:38:30Z | 2,396,246 | <p>use this code to read file line by line:</p>
<pre><code>for line in open('data.txt'):
# work with line
</code></pre>
| 2 | 2010-03-07T12:40:40Z | [
"python",
"file"
] |
Memory error due to the huge input file size | 2,396,238 | <p>When I using the following code to read file:</p>
<pre><code>lines=file("data.txt").read().split("\n")
</code></pre>
<p>I have the following error</p>
<pre><code>MemoryError
</code></pre>
<p>the file size is</p>
<pre><code>ls -l
-rw-r--r-- 1 charlie charlie 1258467201 Sep 26 12:57 data.txt
</code></pre>
| 1 | 2010-03-07T12:38:30Z | 2,396,247 | <p>Obviously the file is too large to be read into memory all at once.</p>
<p>Why not just use:</p>
<pre><code>with open("data.txt") as myfile:
for line in myfile:
do_something(line.rstrip("\n"))
</code></pre>
<p>or, if you're not on Python 2.6 and higher:</p>
<pre><code>myfile = open("data.txt")
for li... | 13 | 2010-03-07T12:40:44Z | [
"python",
"file"
] |
How to supress Powershell window when using the -File option | 2,396,271 | <p>I'm calling Powershell like so:</p>
<pre><code>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -noninteractive -nologo -file "C:\Users\dummy\Documents\dev\powershell\samples\test.ps1"
</code></pre>
<p>I'm calling it from a python script, but the same problem can be observed if called via a sho... | 1 | 2010-03-07T12:46:42Z | 2,396,301 | <p>You can pass appropriate arguments to <a href="http://msdn.microsoft.com/en-us/library/ms684863%28v=VS.85%29.aspx" rel="nofollow">CreateProcess</a> or <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.processwindowstyle%28v=VS.90%29.aspx" rel="nofollow">Process.Start</a> to suppress the console win... | 2 | 2010-03-07T13:01:05Z | [
"python",
"powershell",
"popen",
"windowless"
] |
How to supress Powershell window when using the -File option | 2,396,271 | <p>I'm calling Powershell like so:</p>
<pre><code>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -noninteractive -nologo -file "C:\Users\dummy\Documents\dev\powershell\samples\test.ps1"
</code></pre>
<p>I'm calling it from a python script, but the same problem can be observed if called via a sho... | 1 | 2010-03-07T12:46:42Z | 2,396,308 | <p>Use <code>-WindowStyle Hidden</code>. See <a href="http://technet.microsoft.com/en-us/library/dd315276.aspx" rel="nofollow">here</a>.</p>
| 0 | 2010-03-07T13:02:48Z | [
"python",
"powershell",
"popen",
"windowless"
] |
How to supress Powershell window when using the -File option | 2,396,271 | <p>I'm calling Powershell like so:</p>
<pre><code>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -noninteractive -nologo -file "C:\Users\dummy\Documents\dev\powershell\samples\test.ps1"
</code></pre>
<p>I'm calling it from a python script, but the same problem can be observed if called via a sho... | 1 | 2010-03-07T12:46:42Z | 2,397,018 | <p>I had no luck with <code>-WindowStyle Hidden</code>, because a console window appeared every time for a while. </p>
<p>That's why I use a helper exe called PsRun.exe that does exactly that. You can download source and exe file <a href="http://www.leporelo.eu/blog.aspx?id=run-scheduled-tasks-with-winform-gui-in-powe... | 1 | 2010-03-07T16:48:20Z | [
"python",
"powershell",
"popen",
"windowless"
] |
migrating from one framework to another in python | 2,396,294 | <p>I'm having trouble deciding which python framework to use for my website. So I've decided to bite the bullet and use Django. My question is how easy (or difficult) will it be to migrate to a different framework in future if I have issues with Django ?</p>
| 0 | 2010-03-07T12:57:10Z | 2,396,341 | <p>Your database queries(and object models), url config, and templates to say the least will all be specific to django. That said - if you understand what you're doing, recreating them in another package shouldn't take too long if you really need to at some later time.</p>
<p>edit: this is all assuming you dont integr... | 1 | 2010-03-07T13:13:10Z | [
"python",
"django",
"frameworks",
"migrate"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.