content stringlengths 85 101k | title stringlengths 0 150 | question stringlengths 15 48k | answers list | answers_scores list | non_answers list | non_answers_scores list | tags list | name stringlengths 35 137 |
|---|---|---|---|---|---|---|---|---|
Q:
Need help with the regular expressions in Python
Help please to make from the string like:
<a href="http://testsite.com" class="className">link_text_part1 <em>another_text</em> link_text_part2</a>
string like:
link_text_part1 another_text link_text_part2
using regular expressions in Python
!note testsite.com cha... | Need help with the regular expressions in Python | Help please to make from the string like:
<a href="http://testsite.com" class="className">link_text_part1 <em>another_text</em> link_text_part2</a>
string like:
link_text_part1 another_text link_text_part2
using regular expressions in Python
!note testsite.com changes
| [
"So you want to remove the <a> and <em> tags? That can be done like this:\n>>> s = '<a href=\"http://testsite.com\" class=\"className\">link_text_part1 <em>another_text</em> link_text_part2</a>'\n\n>>> re.sub(\"</?(a|em).*?>\", \"\", s)\n'link_text_part1 another_text link_text_part2'\n\nIn English, this searches f... | [
1,
1,
1,
0
] | [] | [] | [
"python",
"scrapy"
] | stackoverflow_0003317328_python_scrapy.txt |
Q:
Making text bold with django
I have to send make some text bold in between plain text and send it to the template from the view. I do this:
I save a string like this <b>TextPlaintext</b> in a variable and return it to the template.
The "<b>" tags are not interpreted.
How can make some text bold in a django view?
... | Making text bold with django | I have to send make some text bold in between plain text and send it to the template from the view. I do this:
I save a string like this <b>TextPlaintext</b> in a variable and return it to the template.
The "<b>" tags are not interpreted.
How can make some text bold in a django view?
| [
"Django automatically escapes string values in templates, to improve security.\nIf you know that a value has HTML in it, and is trusted, then you can turn off escaping:\n{{my_trusted_html|safe}}\n\n",
"Making a text bold shouldn't be done in the view. Indeed, the view should not take care of formatting (which is ... | [
7,
3,
1
] | [] | [] | [
"django",
"python"
] | stackoverflow_0003329626_django_python.txt |
Q:
What does this stand for?
What does '\r' mean? What does it do? I have never seen it before and its giving me headaches. It doesnt seem to have any purpose, since 'a\ra' prints as 'aa', but its not the same as the string 'aa'. Im using python 2.6
A:
It's an old control character from typewriters.
It means "carri... | What does this stand for? | What does '\r' mean? What does it do? I have never seen it before and its giving me headaches. It doesnt seem to have any purpose, since 'a\ra' prints as 'aa', but its not the same as the string 'aa'. Im using python 2.6
| [
"It's an old control character from typewriters.\nIt means \"carriage return\". In this time, when you pressed \"enter\", you were going to the next line, then the carriage went back to the beginning of the line (hence the carriage return).\nThen with computers, different OSes made different choices to represent ne... | [
10,
8,
1,
0
] | [] | [] | [
"python",
"syntax"
] | stackoverflow_0003329775_python_syntax.txt |
Q:
Globbing with python rpm module?
The following code uses the rpm module to query the version of an installed package. What I would like to do is to query a set of packages specified by a glob, for example searching for "python*" rather than "python". Is this possible using the rpm module?
1 #!/usr/bin/python
... | Globbing with python rpm module? | The following code uses the rpm module to query the version of an installed package. What I would like to do is to query a set of packages specified by a glob, for example searching for "python*" rather than "python". Is this possible using the rpm module?
1 #!/usr/bin/python
2
3 import rpm
4
5 ts = rpm.T... | [
"import rpm\nts = rpm.TransactionSet()\nmi = ts.dbMatch()\nmi.pattern('name', rpm.RPMMIRE_GLOB, 'py*' )\nfor h in mi:\n # Do something with the header... \n\n"
] | [
5
] | [] | [] | [
"glob",
"python",
"rpm",
"search"
] | stackoverflow_0003311760_glob_python_rpm_search.txt |
Q:
data structure that can do a "select distinct X where W=w and Y=y and Z=z and ..." type lookup
I have a set of unique vectors (10k's worth). And I need to, for any chosen column, extract the set of values that are seen in that column, in rows where all the others columns are given values.
I'm hoping for a solution... | data structure that can do a "select distinct X where W=w and Y=y and Z=z and ..." type lookup | I have a set of unique vectors (10k's worth). And I need to, for any chosen column, extract the set of values that are seen in that column, in rows where all the others columns are given values.
I'm hoping for a solution that is sub linear (wrt the item count) in time and at most linear (wrt the total size of all the i... | [
"Since you are asking for a SQL-like query, how about using a relational database? SQLite is part of the standard library, and can be used either on-disk or fully in memory.\n",
"If you have a Python set (no ordering) there is no way to select all relevant items without at least looking at all items -- so it's i... | [
11,
5,
2,
1,
0
] | [] | [] | [
"data_structures",
"python"
] | stackoverflow_0003327702_data_structures_python.txt |
Q:
Really weird Cookie header behaviour? - Cookies
I'm using Firefox 3.6.8 for these tests.
I'm setting a cookie within the response headers of my web app using:
Set-Cookie: session=7878dfdsfjsdf89sd89f8df9
This does not seem to override the session Cookie.
When a request is performed instead Firefox even sends dup... | Really weird Cookie header behaviour? - Cookies | I'm using Firefox 3.6.8 for these tests.
I'm setting a cookie within the response headers of my web app using:
Set-Cookie: session=7878dfdsfjsdf89sd89f8df9
This does not seem to override the session Cookie.
When a request is performed instead Firefox even sends duplicate cookies:
Cookie: session=7d75cd8f55895cbccb0d3... | [
"If you don't specify the path or domain for a cookie when setting it, it defaults to the current path and current hostname. If you then go ahead and try setting the same cookie name from a URL with a different path or hostname, it will add a new cookie instead of replacing the old one.\nI suspect what you want to... | [
6,
3
] | [] | [] | [
"cookies",
"django",
"http",
"http_headers",
"python"
] | stackoverflow_0003327152_cookies_django_http_http_headers_python.txt |
Q:
Is it common/good practice to test for type values in Python?
Is it common in Python to keep testing for type values when working in a OOP fashion?
class Foo():
def __init__(self,barObject):
self.bar = setBarObject(barObject)
def setBarObject(barObject);
if (isInstance(barObject,Bar):
... | Is it common/good practice to test for type values in Python? | Is it common in Python to keep testing for type values when working in a OOP fashion?
class Foo():
def __init__(self,barObject):
self.bar = setBarObject(barObject)
def setBarObject(barObject);
if (isInstance(barObject,Bar):
self.bar = barObject
else:
# throw exce... | [
"Nope, in fact it's overwhelmingly common not to test for type values, as in your second approach. The idea is that a client of your code (i.e. some other programmer who uses your class) should be able to pass any kind of object that has all the appropriate methods or properties. If it doesn't happen to be an insta... | [
18,
1,
0,
0
] | [] | [] | [
"introspection",
"oop",
"python"
] | stackoverflow_0003327454_introspection_oop_python.txt |
Q:
Object_list always empty
the app is working this way. That i have a simple news adding model as below:
class News(models.Model):
title = models.CharField(max_length=100)
publication_date = models.DateField(auto_now_add=True)
content = models.TextField()
the view
def homepage(request):
posts= New... | Object_list always empty | the app is working this way. That i have a simple news adding model as below:
class News(models.Model):
title = models.CharField(max_length=100)
publication_date = models.DateField(auto_now_add=True)
content = models.TextField()
the view
def homepage(request):
posts= News.objects.all() #.get(title="a... | [
"When you use get, the variable posts contains an instance of News. On the other hand, if you use .all(), posts will contain a queryset. So first I would suggest you use filter instead of get, so posts would always be a queryset, and therefore you wouldn't have such an inconsistent behaviour ...\n",
"Please post ... | [
0,
0,
0
] | [] | [] | [
"django",
"python"
] | stackoverflow_0003329624_django_python.txt |
Q:
AttributeError: trying to match list of string identifiers from file1 in file2
Here is a brief summary of my aims. I have a list of data in the data text file that are basically names or identifiers. The list of names is all on one line and seperated by a space. I want to make each data a seperate line. These data... | AttributeError: trying to match list of string identifiers from file1 in file2 | Here is a brief summary of my aims. I have a list of data in the data text file that are basically names or identifiers. The list of names is all on one line and seperated by a space. I want to make each data a seperate line. These data are identifiers. If for instance one name from the original data text file in also ... | [
"line = [item for item in open('C:\\chiptext.txt', 'r').read().split(' ')\n if item.startswith(\"SNP\") or item.startswith(\"AFFY\")]\n\nThis is making line a list of strings. A list object does not have a split method.\nIt looks like you want a list of all the names in datatext and a subset of that list f... | [
2
] | [] | [] | [
"python"
] | stackoverflow_0003330690_python.txt |
Q:
Limit the number of sentences in a string
A beginner's Python question:
I have a string with x number of sentences. How to I extract first 2 sentences (may end with . or ? or !)
A:
Ignoring considerations such as when a . constitutes the end of sentence:
import re
' '.join(re.split(r'(?<=[.?!])\s+', phrase, 2)[:... | Limit the number of sentences in a string | A beginner's Python question:
I have a string with x number of sentences. How to I extract first 2 sentences (may end with . or ? or !)
| [
"Ignoring considerations such as when a . constitutes the end of sentence:\nimport re\n' '.join(re.split(r'(?<=[.?!])\\s+', phrase, 2)[:-1])\n\nEDIT: Another approach that just occurred to me is this:\nre.match(r'(.*?[.?!](?:\\s+.*?[.?!]){0,1})', phrase).group(1)\n\nNotes:\n\nWhereas the first solution lets you rep... | [
10,
1,
0,
0,
0
] | [] | [] | [
"python"
] | stackoverflow_0003329386_python.txt |
Q:
Django: How to find out whether RawQuetySet has rows ? There's no count() method
I think the title speaks for itself.
I have a complex query with a subquery, but sometimes it returns no values, which is absolutely normal. But I can not prevent the ValueError message, cuz I am not able to find out whether RawQueryS... | Django: How to find out whether RawQuetySet has rows ? There's no count() method | I think the title speaks for itself.
I have a complex query with a subquery, but sometimes it returns no values, which is absolutely normal. But I can not prevent the ValueError message, cuz I am not able to find out whether RawQuerySet is empty or not. The RQS object is always present, but if I try to access it's firs... | [
"Catch the exception?\ntry:\n return results[0].id\nexcept IndexError:\n pass # no rows returned\n\nor\nimport itertools\n\nresults_list = []\ntry:\n for i in itertools.count(0):\n results_list.append(results[i])\nexcept IndexError:\n pass # no more rows\nreturn results_list\n\n"
] | [
0
] | [] | [] | [
"django",
"django_models",
"python"
] | stackoverflow_0003330933_django_django_models_python.txt |
Q:
What is the proper method of printing Python Exceptions?
except ImportError as xcpt:
print "Import Error: " + xcpt.message
Gets you a deprecation warning in 2.6 because message is going away.
Stackoverflow
How should you be dealing with ImportError? (Note, this is a built-in exception, not on... | What is the proper method of printing Python Exceptions? | except ImportError as xcpt:
print "Import Error: " + xcpt.message
Gets you a deprecation warning in 2.6 because message is going away.
Stackoverflow
How should you be dealing with ImportError? (Note, this is a built-in exception, not one of my making....)
| [
"The correct approach is \nxcpt.args\n\nOnly the message attribute is going away. The exception will continue to exist and it will continue to have arguments.\nRead this: http://www.python.org/dev/peps/pep-0352/ which has some rational for removing the messages attribute.\n",
"If you want to print the exception:... | [
9,
2
] | [] | [] | [
"exception",
"python"
] | stackoverflow_0003330991_exception_python.txt |
Q:
Unit testing: More Actions than Expected after calling addAction Method
Here is my class:
class ManagementReview(object):
"""Class describing ManagementReview Object.
"""
# Class attributes
id = 0
Title = 'New Management Review Object'
fiscal_year = ''
region = ''
review_date = ''
... | Unit testing: More Actions than Expected after calling addAction Method | Here is my class:
class ManagementReview(object):
"""Class describing ManagementReview Object.
"""
# Class attributes
id = 0
Title = 'New Management Review Object'
fiscal_year = ''
region = ''
review_date = ''
date_completed = ''
prepared_by = ''
__goals = [] # List of <Man... | [
"see if you are keeping track of actions in a class attribute of ManagementReview as opposed to an instance attribute\nA class attribute will be something like\nclass Spam(object):\n actions = []\n\nand an instance attribute will look something like\nclass Spam(object):\n def __init__(self):\n self.act... | [
0
] | [] | [] | [
"class_design",
"python",
"unit_testing"
] | stackoverflow_0003331059_class_design_python_unit_testing.txt |
Q:
IronPython: Is there an alternative to significant whitespace?
For rapidly changing business rules, I'm storing IronPython fragments in XML files. So far this has been working out well, but I'm starting to get to the point where I need more that just one-line expressions.
The problem is that XML and significant wh... | IronPython: Is there an alternative to significant whitespace? | For rapidly changing business rules, I'm storing IronPython fragments in XML files. So far this has been working out well, but I'm starting to get to the point where I need more that just one-line expressions.
The problem is that XML and significant whilespace don't play well together. Before I abandon it for another l... | [
"IronPython doesn't have an alternate syntax. It's an implementation of Python, and Python uses significant indentation (all languages use significant whitespace, not sure why we talk about whitespace when it's only indentation that's unusual in the Python case).\n",
">>> from __future__ import braces\n File \"... | [
5,
4,
3,
2,
2
] | [] | [] | [
"ironpython",
"python"
] | stackoverflow_0003330983_ironpython_python.txt |
Q:
Strip the last character sent by JavaScript through websockets to Python
I'm currently trying out websockets, creating a client in JavaScript and a server in Python.
I'm stuck on a simple problem, though: when I send something from the client to the server it always contains a special ending character, but I don't... | Strip the last character sent by JavaScript through websockets to Python | I'm currently trying out websockets, creating a client in JavaScript and a server in Python.
I'm stuck on a simple problem, though: when I send something from the client to the server it always contains a special ending character, but I don't know how to remove it.
I've tried data[:-1] thinking that would get rid of it... | [
"The expression \"data[:-1]\" is an expression that produces a copy of data missing the last character. It doesn't modify the \"data\" variable. To do that, you have to assign back to \"data\", like so:\ndata = data[:-1]\n\nMy suspicion is the \"special ending character\" is a bug, somewhere, either in your code ... | [
1
] | [] | [] | [
"javascript",
"python",
"websocket"
] | stackoverflow_0003331220_javascript_python_websocket.txt |
Q:
How would an irc bot written in tcl stack up against a python/node.js clone?
I believe eggdrop is the most active/popular bot and it's written in tcl ( and according to wiki the core is C but I haven't confirmed that ).
I'm wondering if there would be any performance benefit of recoding it's functionality in node.... | How would an irc bot written in tcl stack up against a python/node.js clone? | I believe eggdrop is the most active/popular bot and it's written in tcl ( and according to wiki the core is C but I haven't confirmed that ).
I'm wondering if there would be any performance benefit of recoding it's functionality in node.js or Python, in addition to making it more accessible since Python and JS are arg... | [
"As you suspected, eggdrop is not written in tcl, it is written in C, however it does use tcl as its scripting/extension language.\nI would expect that in the case of an eggdrop, the performance difference between using tcl as a scripting language, and using Python, Lua, JS, or virtually anything else would be negl... | [
6,
4
] | [] | [] | [
"eggdrop",
"irc",
"node.js",
"python",
"tcl"
] | stackoverflow_0003331027_eggdrop_irc_node.js_python_tcl.txt |
Q:
Django aggregate and grouping : code cleanliness problem
Here is a small problem I am having.
3 very simple models :
>>> class Instrument(models.Model):
... name = models.CharField(max_length=100)
...
>>> class Musician(models.Model):
... instrument = models.ForeignKey(Instrument)
...
>>> class Song(m... | Django aggregate and grouping : code cleanliness problem | Here is a small problem I am having.
3 very simple models :
>>> class Instrument(models.Model):
... name = models.CharField(max_length=100)
...
>>> class Musician(models.Model):
... instrument = models.ForeignKey(Instrument)
...
>>> class Song(models.Model):
... author = models.ForeignKey(Musician)
I w... | [
"from Django docs:\nfrom django.db.models import Count\nSong.objects.values('author','author__instrument').annotate(Count(\"id\"))\n\nI'm not 100% sure it will work (it's 2:20 AM), but I hope so.\n"
] | [
4
] | [] | [] | [
"django",
"group_by",
"python"
] | stackoverflow_0003331299_django_group_by_python.txt |
Q:
Python: Unpacking an inner nested tuple/list while still getting its index number
I am familiar with using enumerate():
>>> seq_flat = ('A', 'B', 'C')
>>> for num, entry in enumerate(seq_flat):
print num, entry
0 A
1 B
2 C
I want to be able to do the same for a nested list:
>>> seq_nested = (('A', 'Apple'... | Python: Unpacking an inner nested tuple/list while still getting its index number | I am familiar with using enumerate():
>>> seq_flat = ('A', 'B', 'C')
>>> for num, entry in enumerate(seq_flat):
print num, entry
0 A
1 B
2 C
I want to be able to do the same for a nested list:
>>> seq_nested = (('A', 'Apple'), ('B', 'Boat'), ('C', 'Cat'))
I can unpack it with:
>>> for letter, word in seq_nest... | [
"for i, (letter, word) in enumerate(seq_nested):\n print i, letter, word\n\n"
] | [
84
] | [] | [] | [
"enumerate",
"iterable_unpacking",
"list",
"python",
"tuples"
] | stackoverflow_0003331643_enumerate_iterable_unpacking_list_python_tuples.txt |
Q:
Resuming a large file write in Python
I have a big file transfer (say 4gb or so) and rather than using shutil, I'm just opening and writing it the normal file way so I can include a progress percentage as it moves along.
It then occurred to me to try to attempt to resume the file write, if for some reason it bork... | Resuming a large file write in Python | I have a big file transfer (say 4gb or so) and rather than using shutil, I'm just opening and writing it the normal file way so I can include a progress percentage as it moves along.
It then occurred to me to try to attempt to resume the file write, if for some reason it borked out during the process. I haven't had an... | [
"For the second part of your question, data is typically read from and written to a hard drive in blocks of 512 bytes. So using a block size that is a multiple of that should give the most efficient transfer. Other than that, it doesn't matter much. Just keep in mind that whatever block size you specify is the amou... | [
1
] | [] | [] | [
"file_io",
"python",
"resume"
] | stackoverflow_0003331825_file_io_python_resume.txt |
Q:
certain utf characters do not show up on browsers and fails python script
I generated a SQL script from a C# application on Windows 7. The name entries have utf8 characters. It works find on Windows machine where I use a python script to populate the db. Now the same script fails on Linux platform complaining abou... | certain utf characters do not show up on browsers and fails python script | I generated a SQL script from a C# application on Windows 7. The name entries have utf8 characters. It works find on Windows machine where I use a python script to populate the db. Now the same script fails on Linux platform complaining about those special characters.
Similar things happened when I generated XML file c... | [
"Please give a small example of a script with \"utf8 characters\" in the \"name entries\". Are you sure that they are utf8 and not some windows encoding like `cp1252'? What makes you sure? Try this in Python at the command prompt:\n... python -c \"print repr(open('small_script.sql', 'rb').read())\"\n\nThe interesti... | [
1,
0
] | [] | [] | [
"c#",
"character_encoding",
"python",
"utf_8",
"windows_7"
] | stackoverflow_0003331850_c#_character_encoding_python_utf_8_windows_7.txt |
Q:
Hierarchical Task Network Planner in Python
Is anyone aware of a hierarchical task network planner implemented in Python or Java? I've found a few open source systems, but they're all seemingly dead projects and haven't been maintained in years.
A:
How about JSHOP2?
| Hierarchical Task Network Planner in Python | Is anyone aware of a hierarchical task network planner implemented in Python or Java? I've found a few open source systems, but they're all seemingly dead projects and haven't been maintained in years.
| [
"How about JSHOP2?\n"
] | [
1
] | [] | [] | [
"artificial_intelligence",
"java",
"machine_learning",
"planning",
"python"
] | stackoverflow_0003326310_artificial_intelligence_java_machine_learning_planning_python.txt |
Q:
How do I get python.vim to work with vim?
I am playing around with vim and I heard that python.vim has some nifty settings for python.
Link to python.vim
http://www.vim.org/scripts/script.php?script_id=790
Q1: How do I integrate python.vim with vim?
Q2: Because I am not familiar with vim, if I use something like... | How do I get python.vim to work with vim? | I am playing around with vim and I heard that python.vim has some nifty settings for python.
Link to python.vim
http://www.vim.org/scripts/script.php?script_id=790
Q1: How do I integrate python.vim with vim?
Q2: Because I am not familiar with vim, if I use something like python.vim will it have a crazy effect on non-... | [
"Q1: \nFollow the installation details in the python.vim files description\n\"install details\nPlace python.vim file in ~/.vim/syntax/ folder.\"\nQ2:\npython.vim is a filetype plugin so it will only work when you are editing .py files.\nRegarding your update:\nTry issuing the command:\n:syntax on\n\nThis will turn... | [
4,
0
] | [] | [] | [
"python",
"settings",
"vim"
] | stackoverflow_0003332144_python_settings_vim.txt |
Q:
Prepend prefix to list elements with list comprehension
Having a list like this:
['foo','spam','bar']
is it possible, using list comprehension, to obtain this list as result?
['foo','ok.foo', 'spam', 'ok.spam', 'bar', 'ok.bar']
A:
In [67]: alist = ['foo','spam', 'bar']
In [70]: [prefix+elt for elt in alist for... | Prepend prefix to list elements with list comprehension | Having a list like this:
['foo','spam','bar']
is it possible, using list comprehension, to obtain this list as result?
['foo','ok.foo', 'spam', 'ok.spam', 'bar', 'ok.bar']
| [
"In [67]: alist = ['foo','spam', 'bar']\n\nIn [70]: [prefix+elt for elt in alist for prefix in ('','ok.') ]\nOut[70]: ['foo', 'ok.foo', 'spam', 'ok.spam', 'bar', 'ok.bar']\n\n",
"With list comprehensions, you're creating new lists, not appending elements to an existing list (which may be relevant on really large ... | [
31,
1
] | [] | [] | [
"list_comprehension",
"python"
] | stackoverflow_0003330880_list_comprehension_python.txt |
Q:
pyxmpp: quick tutorial for creating a muc client?
I'm attempting to write a quick load-test script for our ejabberd cluster that simply logs into a chat room, posts a couple of random messages, then exits.
We had attempted this particular test with tsung, but according to the authors, the muc functionality did not... | pyxmpp: quick tutorial for creating a muc client? | I'm attempting to write a quick load-test script for our ejabberd cluster that simply logs into a chat room, posts a couple of random messages, then exits.
We had attempted this particular test with tsung, but according to the authors, the muc functionality did not make it into this release.
pyxmpp seems to have this f... | [
"Hey I stumbled over your question a few times, while trying the same thing.\nHere is my answer:\nUsing http://pyxmpp.jajcus.net/svn/pyxmpp/trunk/examples/echobot.py as a quickstart, all you have to do is import the MUC-Stuff\nfrom pyxmpp.jabber.muc import MucRoomState, MucRoomManager\n\nAnd once your Client is con... | [
6
] | [] | [] | [
"ejabberd",
"multiuserchat",
"python",
"xmpp"
] | stackoverflow_0002364039_ejabberd_multiuserchat_python_xmpp.txt |
Q:
Python for-loop counter error
I am attempting to script a short code to figure out the number of days it takes to reach a given principal in the bank due to daily interest. Using my code below does not yield any errors when run in IDLE, but the counter returns 0. Any ideas what I missed?
def main():
# irreleva... | Python for-loop counter error | I am attempting to script a short code to figure out the number of days it takes to reach a given principal in the bank due to daily interest. Using my code below does not yield any errors when run in IDLE, but the counter returns 0. Any ideas what I missed?
def main():
# irrelevant code elided by msw, Bal, Int and... | [
"I'm not sure what you're getting at with this loop:\nfor i in range(0):\n if (Bal * Int) == Tar:\n print '1'\n else:\n counter + 1\n\n\nrange(0) is an empty list, so the loop won't execute at all.\ncounter + 1 simply calculates one more than counter, it won't increment counter, you probably mea... | [
6,
3,
2,
0,
0,
0,
0
] | [] | [] | [
"counter",
"for_loop",
"python"
] | stackoverflow_0003331591_counter_for_loop_python.txt |
Q:
How can I search a text in some website (not from the source) with Python?
I want to make an "autofill" that works like this:
The site contains the Name and down the Name has the field to write it.
So, I want to make a program the search the "Name" in the website, and before that, click down the "Name" and write t... | How can I search a text in some website (not from the source) with Python? | I want to make an "autofill" that works like this:
The site contains the Name and down the Name has the field to write it.
So, I want to make a program the search the "Name" in the website, and before that, click down the "Name" and write the name (easy part)...
How can I search for it?
I can't use the site forms, beca... | [
"Try: Automate firefox with python? and https://addons.mozilla.org/en-US/firefox/addon/7620\n"
] | [
0
] | [] | [] | [
"python"
] | stackoverflow_0003331032_python.txt |
Q:
Python: How to override data attributes in method calls?
My question is how to use data attributes in a method but allow them to be overridden individually when calling the method. This example demonstrates how I tried to do it:
class Class:
def __init__(self):
self.red = 1
self.blue = 2
... | Python: How to override data attributes in method calls? | My question is how to use data attributes in a method but allow them to be overridden individually when calling the method. This example demonstrates how I tried to do it:
class Class:
def __init__(self):
self.red = 1
self.blue = 2
self.yellow = 3
def calculate(self, red=self.red, blu... | [
"You cannot refer to self since it's not in scope there yet.\nThe idiomatic way is to do this instead:\ndef calculate(self, red=None, blue=None, yellow=None):\n if red is None:\n red = self.red\n if blue is None:\n blue = self.blue\n if yellow is None:\n yellow = self.yellow\n retur... | [
4,
1,
0
] | [] | [] | [
"attributes",
"methods",
"python"
] | stackoverflow_0003330874_attributes_methods_python.txt |
Q:
how to get started with google app-engine?
I m starting to build python application in windows platform using google appengine
whats the steps to debug and run my application
A:
On Windows I use Aptana.
Once you've installed that, run it, go to the Plugins tab and get Pydev.
Pydev has inbuilt support for google ... | how to get started with google app-engine? | I m starting to build python application in windows platform using google appengine
whats the steps to debug and run my application
| [
"On Windows I use Aptana.\nOnce you've installed that, run it, go to the Plugins tab and get Pydev.\nPydev has inbuilt support for google app engine - so you can create an app engine project, and then run or debug it. See these posts for more details:\nhttp://pydev.blogspot.com/2009/05/testing-on-pydev-146-google-a... | [
2
] | [] | [] | [
"google_app_engine",
"python"
] | stackoverflow_0003332900_google_app_engine_python.txt |
Q:
How to capture the text wthin the brackets: (), using regex maybe?
any way would be fine. Perl, python, ruby...
A:
You can match this regex
\(.*?\)
Edit:
The above regex will also include the brackets as a part of matched string. To avoid getting the brackets as a part of match (i.e. only match string inside th... | How to capture the text wthin the brackets: (), using regex maybe? | any way would be fine. Perl, python, ruby...
| [
"You can match this regex\n\\(.*?\\)\n\nEdit:\nThe above regex will also include the brackets as a part of matched string. To avoid getting the brackets as a part of match (i.e. only match string inside the starting and ending bracket, excluding brackets) you may use below regex. \n(?<=\\().*?(?=\\))\n\n",
"In pe... | [
3,
2,
1,
0
] | [] | [] | [
"perl",
"python",
"regex",
"ruby"
] | stackoverflow_0003332442_perl_python_regex_ruby.txt |
Q:
NameError for using timeit in python
I got NameError when I try to run this codes."global name j is not defined". How can I fix it?
def test(j):
for i in range(j):
j = i**2
if __name__=='__main__':
from timeit import Timer
j = 30
t = Timer("test(j)","from __main__ import test")
print( ... | NameError for using timeit in python | I got NameError when I try to run this codes."global name j is not defined". How can I fix it?
def test(j):
for i in range(j):
j = i**2
if __name__=='__main__':
from timeit import Timer
j = 30
t = Timer("test(j)","from __main__ import test")
print( t.timeit(j))
| [
"Timer doesn't know about j. You need to do something like \"test(%d)\" % j (or from __main__ import j or put the definition of j inside the string, too).\nAlso, the argument to timeit is different from the argument to your test function (so the different uses of j are probably not what you should do or mean). The ... | [
3
] | [] | [] | [
"python",
"timeit"
] | stackoverflow_0003333256_python_timeit.txt |
Q:
Speeding up parsing of HUGE lists of dictionaries - Python
I'm using MongoDB an nosql database. Basically as a result of a query I have a list of dicts which themselves contains lists of dictionaries... which I need to work with.
Unfortunately dealing with all this data within Python can be brought to a crawl when... | Speeding up parsing of HUGE lists of dictionaries - Python | I'm using MongoDB an nosql database. Basically as a result of a query I have a list of dicts which themselves contains lists of dictionaries... which I need to work with.
Unfortunately dealing with all this data within Python can be brought to a crawl when the data is too much.
I have never had to deal with this probl... | [
"Do you really want all of that data back in your Python program? If so fetch it back a little at a time, but if all you want to do is summarise the data then use mapreduce in MongoDB to distribute the processing and just return the summarised data.\nAfter all, the point about using a NoSQL database that cleanly sh... | [
3,
1,
1
] | [] | [] | [
"dictionary",
"list",
"parsing",
"python",
"sorting"
] | stackoverflow_0003330668_dictionary_list_parsing_python_sorting.txt |
Q:
python: overriding access a var
I have a class:
class A:
s = 'some string'
b = <SOME OTHER INSTANCE>
now I want this class to have the functionality of a string whenever it can. That is:
a = A()
print a.b
will print b's value. But I want functions that expect a string (for example replace) to work. For e... | python: overriding access a var | I have a class:
class A:
s = 'some string'
b = <SOME OTHER INSTANCE>
now I want this class to have the functionality of a string whenever it can. That is:
a = A()
print a.b
will print b's value. But I want functions that expect a string (for example replace) to work. For example:
'aaaa'.replace('a', a)
to ac... | [
"If you want your class to have the functionality of a string, just extend the built in string class.\n>>> class A(str):\n... b = 'some other value'\n...\n>>> a = A('x')\n>>> a\n'x'\n>>> a.b\n'some other value'\n>>> 'aaa'.replace('a',a)\n'xxx'\n\n",
"Override __str__ or __unicode__ to set the string represent... | [
7,
1,
1
] | [] | [] | [
"overriding",
"python"
] | stackoverflow_0003333101_overriding_python.txt |
Q:
Problem porting sudoku solver from C to Python
I recently wrote a sudoku solver in C to practice programming. After completing it I decided to write an equivalent program in Python for a comparison between the languages and more practice and this is where the problem is. It seems to be that a global variable (sudo... | Problem porting sudoku solver from C to Python | I recently wrote a sudoku solver in C to practice programming. After completing it I decided to write an equivalent program in Python for a comparison between the languages and more practice and this is where the problem is. It seems to be that a global variable (sudokupossibilities[][][]) I declared outside the while ... | [
"This line does not do what you think:\nsudokupossibilities = [[[1] * 9] * 9] * 9\n\nTry this simple program:\nsudokupossibilities = [[[1] * 9] * 9] * 9\nsudokupossibilities\nsudokupossibilities[1][1][1]=2\nsudokupossibilities\n\n(And the output of a much-simplified version:)\n>>> s=[[[1] * 3] * 3] * 3\n>>> s\n[[[1... | [
12
] | [] | [] | [
"c",
"porting",
"python",
"scope",
"sudoku"
] | stackoverflow_0003333627_c_porting_python_scope_sudoku.txt |
Q:
Load c++ memory file into Python
I have a file that in C++ I load into array using below code:
int SomeTable[10000];
int LoadTable()
{
memset(SomeTable, 0, sizeof(SomeTable));
FILE * fin = fopen("SomeFile.dar", "rb");
size_t bytesread = fread(SomeTable, sizeof(SomeTable), 1, fin);
fclose(fin);
}
... | Load c++ memory file into Python | I have a file that in C++ I load into array using below code:
int SomeTable[10000];
int LoadTable()
{
memset(SomeTable, 0, sizeof(SomeTable));
FILE * fin = fopen("SomeFile.dar", "rb");
size_t bytesread = fread(SomeTable, sizeof(SomeTable), 1, fin);
fclose(fin);
}
The file is binary code of 10000 inte... | [
"Let's write an array into a file using a short C code:\nint main ()\n{\n FILE * pFile;\n int a[3] = {1,2,3};\n pFile = fopen ( \"file.bin\" , \"wb\" );\n fwrite (a , 1 , sizeof(a) , pFile );\n fclose (pFile);\n return 0;\n}\n\nThe binary file can be loaded directly into a python array\nPython 2.6.5 (r265:790... | [
2
] | [] | [] | [
"c++",
"python"
] | stackoverflow_0003333604_c++_python.txt |
Q:
error on localhost
when i'm going to login i got the following error
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3199, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
File "C:\Program Files\Goo... | error on localhost | when i'm going to login i got the following error
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3199, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
File "C:\Program Files\Google\google_appengine\goo... | [
"App Engine runs Python 2.5. You need to install Python 2.5 and use that instead of 2.7.\n"
] | [
6
] | [] | [] | [
"google_app_engine",
"python"
] | stackoverflow_0003333985_google_app_engine_python.txt |
Q:
Google app engine parsing xml more then 1 mb
Hi i need to parse xml file which is more then 1 mb in size, i know GAE can handle request and response up to 10 MB but as we need to use SAX parser API and API GAE has limit of 1 MB so is there way we can parse file more then 1 mb any ways.
A:
The 1MB limit doesn't a... | Google app engine parsing xml more then 1 mb | Hi i need to parse xml file which is more then 1 mb in size, i know GAE can handle request and response up to 10 MB but as we need to use SAX parser API and API GAE has limit of 1 MB so is there way we can parse file more then 1 mb any ways.
| [
"The 1MB limit doesn't apply to parsing; however, you can't fetch more than 1MB from URLfetch; you'll only get the first 1MB from the API.\nIt's probably not going to be possible to get the XML into your application using the URLfetch API. If the data is smaller than 10MB, you can arrange for an external process t... | [
2
] | [] | [] | [
"google_app_engine",
"parsing",
"python"
] | stackoverflow_0003332897_google_app_engine_parsing_python.txt |
Q:
Bitnami Trac 0.11.6 SVN Post commit hooks failing
Beating my head against a wall here for a day trying to get post commit hooks work so I can add refs/ close tickets in trac from an SVN commit.
I used the bitnami trac stack to install and am fairly happy with the way its setup.
Every commit though gives the error
... | Bitnami Trac 0.11.6 SVN Post commit hooks failing | Beating my head against a wall here for a day trying to get post commit hooks work so I can add refs/ close tickets in trac from an SVN commit.
I used the bitnami trac stack to install and am fairly happy with the way its setup.
Every commit though gives the error
svn: MERGE of "/svn/Project": 200 OK (http://10.0.0.20... | [
"Imports were working from command line. The problem turned out to be the path. It wasn't working setting the python path in the script file or as an system variable as PYTHON_PATH or PYTHONPATH. It would run the python command correctly like that but would then not use the correct svn bindings. Adding the python d... | [
3
] | [] | [] | [
"apache",
"bitnami",
"python",
"svn",
"trac"
] | stackoverflow_0003301079_apache_bitnami_python_svn_trac.txt |
Q:
Returning only No. of Google Search Results via Python
I wish to return only the number of google search results for a particular keyword in the fastest manner possible, avoiding (keeping to minimum) the use of third party libraries. I have already considered xgoogle.
A:
Take a look at Alex Martelli's example.
... | Returning only No. of Google Search Results via Python | I wish to return only the number of google search results for a particular keyword in the fastest manner possible, avoiding (keeping to minimum) the use of third party libraries. I have already considered xgoogle.
| [
"Take a look at Alex Martelli's example.\nIf you search for something vague like \"cars\", data will look something like the following. Notice that it isn't very long; you only get the top few hits, and a link to \"moreResultsUrl\". Therefore, it should be reasonably fast to make this query and look in \ndata['curs... | [
2
] | [
"You can use urllib for downloading the site and HTMLParser to parse out the \n<div id=\"resultStats\">....</div> values. Here is an example:\nHow can I use the python HTMLParser library to extract data from a specific div tag?\n"
] | [
-1
] | [
"python"
] | stackoverflow_0003334122_python.txt |
Q:
Finding what list a class instance is in, in Python
This problem is thus: I have an instance of a class, I want to know what list it is a part of, i.e. :
class test_class() :
def test() :
print 'I am a member of list', parent_list
foo = [test_class(), 52, 63]
bar = ['spam', 'eggs']
foo[0].test()
I wo... | Finding what list a class instance is in, in Python | This problem is thus: I have an instance of a class, I want to know what list it is a part of, i.e. :
class test_class() :
def test() :
print 'I am a member of list', parent_list
foo = [test_class(), 52, 63]
bar = ['spam', 'eggs']
foo[0].test()
I would like to print out I am a member of list foo. There ar... | [
"First of all, I don't know what could be the use-case for it, because ideally while putting objects in list, you can track them via a dict or even if you have list of all lists you can just check for objects in them, so a better design wouldn't need such search.\nSo lets suppose for fun we want to know which lists... | [
1,
0,
0,
0
] | [] | [] | [
"introspection",
"python"
] | stackoverflow_0003333494_introspection_python.txt |
Q:
commit & push to remote git repo via webhook?
I want to commit to a git repo from app-engine via webhooks. I cannot install git on appengine. Possible?
I think it should be on GitHub, because they have a browser based text editor which can commit via the browser. E.g. go here and click the edit button.
GitHub api ... | commit & push to remote git repo via webhook? | I want to commit to a git repo from app-engine via webhooks. I cannot install git on appengine. Possible?
I think it should be on GitHub, because they have a browser based text editor which can commit via the browser. E.g. go here and click the edit button.
GitHub api docs imply read-only operations which doesn't seem ... | [
"The tags say you're using python so this might not be particularly useful, but I do know there's a pure java implementation of git, JGit, which might work on the app engine. It doesn't look like you can really call java code from python, but you could use a separate instance that you create yourself and use some s... | [
1,
0
] | [] | [] | [
"git",
"github",
"google_app_engine",
"python"
] | stackoverflow_0001989735_git_github_google_app_engine_python.txt |
Q:
Map comparison operators to function call
I'm building a DSL for form validation in Python, and one of the requirements is to be able to specify that a field should be greater than or less than a constant or another field value. As a result, I'm trying to easily map operators like <, >, <= and >= to their equivale... | Map comparison operators to function call | I'm building a DSL for form validation in Python, and one of the requirements is to be able to specify that a field should be greater than or less than a constant or another field value. As a result, I'm trying to easily map operators like <, >, <= and >= to their equivalent functions in the operator module, so that th... | [
"As far as I'm aware, there is no built-in dictionary mapping the string \">\" to the function operator.lt, etc.\nAs others have pointed out, the Python interpreter itself does not make use of such a dictionary, since the process of parsing and executing Python code will first translate the character sequence \">\"... | [
5,
3
] | [] | [] | [
"python"
] | stackoverflow_0003324788_python.txt |
Q:
Write a Plugin in Python for audio
I have written a script that on execution lets the user record a message by accessing their microphone and stores it.
I want to make this script useable over my website, which will require me to write a plug-in for the browser. Is there a good tutorial that will teach me how to w... | Write a Plugin in Python for audio | I have written a script that on execution lets the user record a message by accessing their microphone and stores it.
I want to make this script useable over my website, which will require me to write a plug-in for the browser. Is there a good tutorial that will teach me how to write this plug in and set it up. is ther... | [
"You'll definitely want to look at:\nhttps://developer.mozilla.org/en/Plugins\nand\nhttp://code.google.com/chrome/extensions/npapi.html\nThat were from the post Ignacio linked: How to write a browser plugin?\n"
] | [
0
] | [] | [] | [
"audio",
"plugins",
"python"
] | stackoverflow_0003292808_audio_plugins_python.txt |
Q:
Mysql connection with python in a class
i'm trying to connect to a database building a class connection()saved in local folder in file utils.py .This is what i worked so far of it:
class connection:
def __init__(self):
self.conn = MySQLdb.connect(host = "localhost",user = "xxx",
... | Mysql connection with python in a class | i'm trying to connect to a database building a class connection()saved in local folder in file utils.py .This is what i worked so far of it:
class connection:
def __init__(self):
self.conn = MySQLdb.connect(host = "localhost",user = "xxx",
passwd = "xxx", db = "xxx",
... | [
"The glaring issue is that you need to instantiate your \"connection\" class before calling methods.\nfrom utils import execute_sql,connection\nmy_con = connection()\ncon = my_con.nume()\ncursor = con.cursor()\n....\ncursor.execute(sql)\n...\nconnection.TearDown()\n\nAs a side note - your connection class seems a b... | [
2
] | [] | [] | [
"class",
"mysql",
"python"
] | stackoverflow_0003334831_class_mysql_python.txt |
Q:
TypeError when iterate over DiGraph()
Hii!
I want to get the time execution of my function ( test(G) ). when I
use Timer I need to write the type of my object : "test(% ?? )" %G
which is DiGraph here. How can I do that?
from networkx import nx
def test(G):
for e in G.edges_iter():
print(e)
if __name_... | TypeError when iterate over DiGraph() | Hii!
I want to get the time execution of my function ( test(G) ). when I
use Timer I need to write the type of my object : "test(% ?? )" %G
which is DiGraph here. How can I do that?
from networkx import nx
def test(G):
for e in G.edges_iter():
print(e)
if __name__=='__main__':
from timeit import Timer... | [
"You should import G from __main__ as well\nimport networkx as nx\n\ndef test(G):\n for e in G.edges_iter():\n print(e)\n\nif __name__=='__main__':\n from timeit import Timer\n G = nx.DiGraph()\n G.add_edges_from([(1,2),(4,5)])\n t = Timer(\"test(G)\",\"from __main__ import test,G\")\n prin... | [
1
] | [] | [] | [
"networkx",
"python"
] | stackoverflow_0003335101_networkx_python.txt |
Q:
How to check if a MySQL connection is closed in Python?
The question says everything. How can I check if my MySQL connection is closed in Python?
I'm using MySQLdb, see http://mysql-python.sourceforge.net/
A:
The Connection.open field will be 1 if the connection is open and 0 otherwise. So you can say
if conn.o... | How to check if a MySQL connection is closed in Python? | The question says everything. How can I check if my MySQL connection is closed in Python?
I'm using MySQLdb, see http://mysql-python.sourceforge.net/
| [
"The Connection.open field will be 1 if the connection is open and 0 otherwise. So you can say\nif conn.open:\n # do something\n\n"
] | [
34
] | [] | [] | [
"mysql",
"python"
] | stackoverflow_0003335342_mysql_python.txt |
Q:
Using Python COM to select files in windows explorer?
Is it possible using Python COM to select files inside of the windows explorer? For example, I am trying to get all "*.txt" files inside of windows explore highlighted without having to select them with the mouse, or without other keyboard gymnastics.
thanks in... | Using Python COM to select files in windows explorer? | Is it possible using Python COM to select files inside of the windows explorer? For example, I am trying to get all "*.txt" files inside of windows explore highlighted without having to select them with the mouse, or without other keyboard gymnastics.
thanks in advance.
| [
"I am not sure if this useful for you, but you might be able to register a pyhook module and make it listen to which window you are selecting, once you get the path then you can process it with python listdir()\nhttp://sourceforge.net/apps/mediawiki/pyhook/index.php?title=Main_Page\n"
] | [
1
] | [] | [] | [
"automation",
"com",
"python",
"windows"
] | stackoverflow_0002892774_automation_com_python_windows.txt |
Q:
Python access parent object instances
I'm currently trying to write a multiple-file Python (2.6.5) game using PyGame. The problem is that one of the files, "pyconsole.py", needs to be able to call methods on instances of other objects imported by the primary file, "main.py". The problem is that I have a list in ... | Python access parent object instances | I'm currently trying to write a multiple-file Python (2.6.5) game using PyGame. The problem is that one of the files, "pyconsole.py", needs to be able to call methods on instances of other objects imported by the primary file, "main.py". The problem is that I have a list in the main file to hold instances of all of t... | [
"\nThe problem is that one of the files,\n \"pyconsole.py\", needs to be able to\n call methods on instances of other\n objects imported by the primary file,\n \"main.py\".\n\nThis just sounds like the dependencies are wrong. Generally nothing should be calling 'backwards' up to the main file. That main.py shou... | [
2,
1,
0,
0
] | [] | [] | [
"pygame",
"python",
"python_import"
] | stackoverflow_0003335230_pygame_python_python_import.txt |
Q:
Python Reportlab RML. How to split table row on two pages
I'm wondering if there is some functionality to split table row on two and more pages. Cause some information in row can be too long for one page, and if one row longer then page size then it's cause an exception.
A:
ReportLab does not text wrapping out o... | Python Reportlab RML. How to split table row on two pages | I'm wondering if there is some functionality to split table row on two and more pages. Cause some information in row can be too long for one page, and if one row longer then page size then it's cause an exception.
| [
"ReportLab does not text wrapping out of the box, so I am assuming you are either using a para in the table cells, or you are breaking your lines manually with simpleSplit.\nIf you text is one line string then you can use\nfrom reportlab.pdfbase.pdfmetrics import stringWidth\ntextWidth = stringWidth(text, fontName,... | [
1
] | [] | [] | [
"python",
"reportlab",
"row"
] | stackoverflow_0003297115_python_reportlab_row.txt |
Q:
What's the best way to get a description of the website, in Python?
Suppose I downloaded the HTML code, and I can parse it.
How do I get the "best" description of that website, if that website does not have meta-description tag?
A:
You could get the first few sentence returned from something like Readability.
Sa... | What's the best way to get a description of the website, in Python? | Suppose I downloaded the HTML code, and I can parse it.
How do I get the "best" description of that website, if that website does not have meta-description tag?
| [
"You could get the first few sentence returned from something like Readability.\nSafari 5 uses it, so it must be alright :)\n",
"It's very hard to come up with a rule that works 100% of the time, obviously, but my suggestion as a starting point would be to look for the first <h1> tag (or <h2>, <h3>, etc - the hig... | [
3,
1,
1
] | [] | [] | [
"html",
"parsing",
"python",
"string",
"templates"
] | stackoverflow_0003332494_html_parsing_python_string_templates.txt |
Q:
Is while True: a suitable way to repeat a block until an accepted case is reached?
Is while True an accepted method for looping over a block of code until an accepted case is reached as below? Is there a more elegant way to do this?
while True:
value = input()
if value == condition:
break
else:... | Is while True: a suitable way to repeat a block until an accepted case is reached? | Is while True an accepted method for looping over a block of code until an accepted case is reached as below? Is there a more elegant way to do this?
while True:
value = input()
if value == condition:
break
else:
pass
# Continue code here.
Thank you for any input.
| [
"That's the way to do this in Python. You don't need the else: pass bit though.\nNote, that in python 2.x you're likely to want raw_input rather than input.\n",
"If it's deterministic, then yes. If it is not deterministic (thus meaning you could be stuck in a loop forever at some statistical likelihood) then no.\... | [
8,
0
] | [] | [] | [
"python",
"while_loop"
] | stackoverflow_0003336052_python_while_loop.txt |
Q:
Create a .txt list of IPs in a subnet
I'd like to make a very simple text (.txt) file. This python program needs to make a list of multiple ranges of IPs in a subnet, each taking up one line.
Example:
10.10.27.1
10.10.27.5
10.10.27.6
10.10.27.26
10.10.27.27
10.10.27.28
10.10.27.29
10.10.27.51
10.10.27.52
10.10.27... | Create a .txt list of IPs in a subnet | I'd like to make a very simple text (.txt) file. This python program needs to make a list of multiple ranges of IPs in a subnet, each taking up one line.
Example:
10.10.27.1
10.10.27.5
10.10.27.6
10.10.27.26
10.10.27.27
10.10.27.28
10.10.27.29
10.10.27.51
10.10.27.52
10.10.27.53
10.10.27.54
The subnet mask will essen... | [
"It looks like a few for loops are all you need:\nnetwork = '10.10.27'\n\nfor host in xrange(100, 255):\n print(\"{network}.{host}\".format(**locals()))\n\n",
"I would keep the script simple, just output all addresses as needed :)\ndef yesno(question):\n output = input(question).lower()\n\n if output == '... | [
1,
0,
0
] | [] | [] | [
"python"
] | stackoverflow_0003336087_python.txt |
Q:
Python - urllib2.urlopen - Why do I get garbled characters?
Here's my problem:
import urllib2
response=urllib2.urlopen('http://proxy-heaven.blogspot.com/')
html=response.read()
print html
It's just this site, and I don't know why the result is all garbled characters. Anyone can help?
A:
Without your output it... | Python - urllib2.urlopen - Why do I get garbled characters? | Here's my problem:
import urllib2
response=urllib2.urlopen('http://proxy-heaven.blogspot.com/')
html=response.read()
print html
It's just this site, and I don't know why the result is all garbled characters. Anyone can help?
| [
"Without your output it's hard to say but I'd bet it's an encoding issue : this website is encoded in utf8. If your terminal is set in iso-latin for example, it won't be possible for it to display characters properly.\n",
"Works for me:\nimport urllib\nresponse=urllib.urlopen('http://proxy-heaven.blogspot.com/')\... | [
1,
1,
0
] | [] | [] | [
"python",
"urllib2"
] | stackoverflow_0003335167_python_urllib2.txt |
Q:
Pulling Data From Multiple Tables in Django
I'm kind of new to Django and am having some trouble pulling from existing tables. I'm trying to pull data from columns on multiple joined tables. I did find a solution, but it feels a bit like cheating and am wondering if my method below is considered proper or not.
c... | Pulling Data From Multiple Tables in Django | I'm kind of new to Django and am having some trouble pulling from existing tables. I'm trying to pull data from columns on multiple joined tables. I did find a solution, but it feels a bit like cheating and am wondering if my method below is considered proper or not.
class Sig(models.Model):
sig_id = models.I... | [
"SigCategory has a ForeignKey pointing at Category, so you can always get from the SigCategory to the Category simply by doing mysigcategory.category (where mysigcategory is your instance of SigCategory.\nIf you haven't previously accessed that relationship from that instance, doing it here will cause an extra data... | [
2
] | [] | [] | [
"django",
"models",
"python"
] | stackoverflow_0003336059_django_models_python.txt |
Q:
"case sequence" in python implemented with dictionaries
i have implemented a function:
def postback(i,user,tval):
"""functie ce posteaza raspunsul bazei de date;stringul din mesaj tb sa fie mai mic de 140 de caractere"""
result = {
1:api.PostDirectMessage(user,'Trebuie sa-mi spui si marca pe care ... | "case sequence" in python implemented with dictionaries | i have implemented a function:
def postback(i,user,tval):
"""functie ce posteaza raspunsul bazei de date;stringul din mesaj tb sa fie mai mic de 140 de caractere"""
result = {
1:api.PostDirectMessage(user,'Trebuie sa-mi spui si marca pe care o cauti'),
2:postmarket(user,tval),
3:api.Pos... | [
"If you absolutely must use a dict, use a dict of functions:\nresult = {\n 1: lambda: api.PostDirectMessage(...),\n 2: lambda: postmarket(...),\n ...\n}\nreturn result[i]()\n\nThe lambda keyword defines an anonymous inline function, and they only get called on the last line.\n",
"The value expressions in... | [
2,
1,
1
] | [] | [] | [
"c++",
"python"
] | stackoverflow_0003336385_c++_python.txt |
Q:
Get the current value of env.hosts list with Python Fabric Library
I've got this code (foo and bar are local servers):
env.hosts = ['foo', 'bar']
def mytask():
print(env.hosts[0])
Which, of course prints foo every iteration.
As you probably know, Fabric iterates through the env.hosts list and executes mytask... | Get the current value of env.hosts list with Python Fabric Library | I've got this code (foo and bar are local servers):
env.hosts = ['foo', 'bar']
def mytask():
print(env.hosts[0])
Which, of course prints foo every iteration.
As you probably know, Fabric iterates through the env.hosts list and executes mytask() on each of them this way:
fab mytask
does
task is executed on foo
ta... | [
"Use env.host_string. You can find a full list of env variables here.\n",
"You can just do:\nenv.hosts = ['foo', 'bar']\n\ndef mytask():\n print(env.host)\n\nBecause when you're in the task as executed by fab, you'll have that var set for free.\n",
"Thanks Marcelo.\nIf you want to actually use env.host_stri... | [
40,
27,
3
] | [] | [] | [
"fabric",
"python"
] | stackoverflow_0003334936_fabric_python.txt |
Q:
When I use httplib for my OAUTH in Python, I always get "CannotSendRequest" and then "
Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response
92. response = callback(request, *callback_args, **callback_kwargs)
File "/home/ea/ea/hell/life/views.py" in... | When I use httplib for my OAUTH in Python, I always get "CannotSendRequest" and then " | Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response
92. response = callback(request, *callback_args, **callback_kwargs)
File "/home/ea/ea/hell/life/views.py" in linkedin_auth
274. token = oauth_linkedin.get_unauthorised_request_token()
File "/hom... | [
"Apparently (from here) this happens if you try to reuse an httplib.HTTP object which had not been fully used. Maybe a connection pool in the library you're using, and an exception getting thrown during the request processing? Suggestion is to create new connection objects every time.\n"
] | [
0
] | [] | [] | [
"connection",
"django",
"httplib",
"oauth",
"python"
] | stackoverflow_0002310143_connection_django_httplib_oauth_python.txt |
Q:
Elegantly generating a datetime from a URL in Django?
I'm working on a web app that will allow the user to do a lookup by date, so that, for example:
results = Something.objects.filter(end = date)
I'm planning on passing in the date information via the URL, like this:
example.com/invoicer?2/9/1984
I'll then gra... | Elegantly generating a datetime from a URL in Django? | I'm working on a web app that will allow the user to do a lookup by date, so that, for example:
results = Something.objects.filter(end = date)
I'm planning on passing in the date information via the URL, like this:
example.com/invoicer?2/9/1984
I'll then grab the date via request.GET, break off the first part and st... | [
"\n[...] break off the first part and store it as the month, delete the slash, break off the second part as the date, etc. etc.\n\nThat's indeed is not an ideal way to generate the datetime. You're better off with string parsing:\n>>> datetime.datetime.strptime('2/9/1984', '%m/%d/%Y')\ndatetime.datetime(1984, 2, 9,... | [
6,
2,
2,
2
] | [] | [] | [
"datetime",
"django",
"python"
] | stackoverflow_0003336529_datetime_django_python.txt |
Q:
In Django I have a complex query where I need only the unique values through a foreign key, is this possible?
I have the following models:
class Indicator(models.Model):
name = models.CharField(max_length=200)
category = models.ForeignKey(IndicatorCategory)
weight = models.IntegerField()
industry =... | In Django I have a complex query where I need only the unique values through a foreign key, is this possible? | I have the following models:
class Indicator(models.Model):
name = models.CharField(max_length=200)
category = models.ForeignKey(IndicatorCategory)
weight = models.IntegerField()
industry = models.ForeignKey(Industry)
def __unicode__(self):
return self.name
class Meta:
ordering ... | [
"This works:\nRating.objects.filter(company__in=[company_a, company_b]).distinct()\n\n\n(Original answer)\nDid you try\nIndicatorRatingOptions.objects.filter(company__in=[company_a, company_b]).distinct()\n\n?\n"
] | [
5
] | [] | [] | [
"django",
"django_models",
"python"
] | stackoverflow_0003323591_django_django_models_python.txt |
Q:
How to handle HTML Arrays with App Engine Python?
I'm stuck with this problem I made an HTML Array, but I can't read it out with Python. Is it even possible to do it in App Engine? I read it was possible in PHP.
This is the html code:
<label for="hashtags">Hashtags: </label><br/>
{% for hashtag in stream.hashtags ... | How to handle HTML Arrays with App Engine Python? | I'm stuck with this problem I made an HTML Array, but I can't read it out with Python. Is it even possible to do it in App Engine? I read it was possible in PHP.
This is the html code:
<label for="hashtags">Hashtags: </label><br/>
{% for hashtag in stream.hashtags %}
<input type="text" value="{{hashtag}}" name="has... | [
"You don't need to include the [] at the end of the name of a field you'd like to treat as a list or array, that's some PHP-specific magic. Instead, just name the field hashtags and in your request handler do this to get a list of hashtags from the request:\nnewHashTags = self.request.get('hashtags', allow_multipl... | [
5
] | [] | [] | [
"google_app_engine",
"html",
"python"
] | stackoverflow_0003336891_google_app_engine_html_python.txt |
Q:
Continuing code execution after a pygtk.main() in python
I have an application where my DataFetch() class "Wraps" around my HBHTray() class for the purpose of interacting with the functions/variables of that class. Unfortunately, I can't seem to be able to get the code to continue execution after my DataFetch() cl... | Continuing code execution after a pygtk.main() in python | I have an application where my DataFetch() class "Wraps" around my HBHTray() class for the purpose of interacting with the functions/variables of that class. Unfortunately, I can't seem to be able to get the code to continue execution after my DataFetch() class makes a instance of HBHTray and calls it, and on the Start... | [
"gobject.threads_init() does not magically put your things into separate threads. It only tells the library that you're going to use threads, and sets up some locking. You'll still have to create the threads yourself.\n",
"Turns out the problem was that I couldn't find a working solution because I was utilizing t... | [
0,
0
] | [] | [] | [
"multithreading",
"pygtk",
"python",
"wrapper"
] | stackoverflow_0003336457_multithreading_pygtk_python_wrapper.txt |
Q:
Crontab wont run python script
When I execute my python script from the command line I have no problems like so:
[rv@med240-183 db]$ python formatdb.py
[rv@med240-183 db]$
When I try to use crontab to run the script every midnight I get a series of errors:
import: unable to open X server `' @ import.c/ImportIm... | Crontab wont run python script | When I execute my python script from the command line I have no problems like so:
[rv@med240-183 db]$ python formatdb.py
[rv@med240-183 db]$
When I try to use crontab to run the script every midnight I get a series of errors:
import: unable to open X server `' @ import.c/ImportImageCommand/367.
/home/rv/ncbi-blast-... | [
"Add \n#!/usr/bin/env python\n\nto the beginning of your script - right now it's trying to execute your script as a bash, that line says \"I'm a python script, please use the right interpreter\". It's also called a hash-bang line, but it needs to be the first line in your script.\n"
] | [
28
] | [] | [] | [
"crontab",
"python"
] | stackoverflow_0003337149_crontab_python.txt |
Q:
twisted: check whether a deferred has already been called
This is what I'm trying to accomplish. I'm making a remote call to a server for information, and I want to block to wait for the info. I created a function that returns a Deferred such that when the RPC comes in with the reply, the deferred is called. Then ... | twisted: check whether a deferred has already been called | This is what I'm trying to accomplish. I'm making a remote call to a server for information, and I want to block to wait for the info. I created a function that returns a Deferred such that when the RPC comes in with the reply, the deferred is called. Then I have a function called from a thread that goes threads.blocki... | [
"There are ways, but you really shouldn't do it. Your code that is firing the Deferred should be keeping track of whether it's fired the Deferred or not in the associated state. Really, when you fire the Deferred, you should lose track of it so that it can get properly garbage collected; that way you never need t... | [
5
] | [] | [] | [
"deferred",
"python",
"twisted"
] | stackoverflow_0003337239_deferred_python_twisted.txt |
Q:
Google App Engine: Handlers and WSGI urls
I am new to GAE and I am creating an application with the webapp framework. I was wondering when do you set handlers in your app.yaml and when you define them in your WSGI?
At first I thought you only have one main.py main file running the WSGIApplication but I notice if ... | Google App Engine: Handlers and WSGI urls | I am new to GAE and I am creating an application with the webapp framework. I was wondering when do you set handlers in your app.yaml and when you define them in your WSGI?
At first I thought you only have one main.py main file running the WSGIApplication but I notice if you want to use the GAE authorization you defin... | [
"Either method of URL-routing is acceptable.\napp.yaml-based URL routing\nIf you can easily structure your app to use app.yaml routing (and authorization), then it's worth trying: it'll be less code you'll have to debug, test, and maintain. \nHere's an example (from Google) with multiple entry points: http://goog... | [
9
] | [] | [] | [
"google_app_engine",
"python"
] | stackoverflow_0003335446_google_app_engine_python.txt |
Q:
setDefault for Nested dictionary in python
How do I use setdefault in python for nested dictionary structures.
eg..
self.table[field] = 0
self.table[date] = []
self.table[value] = {}
I would like to setdefault for these.
A:
Assuming self.table is a dict, you could use
self.table.setdefault(field,0)
The rest ar... | setDefault for Nested dictionary in python | How do I use setdefault in python for nested dictionary structures.
eg..
self.table[field] = 0
self.table[date] = []
self.table[value] = {}
I would like to setdefault for these.
| [
"Assuming self.table is a dict, you could use\nself.table.setdefault(field,0)\n\nThe rest are all similar. Note that if self.table already has a key field, then the value associated with that key is returned. Only if there is no key field is self.table[field] set to 0.\nEdit: Perhaps this is closer to what you want... | [
1
] | [] | [] | [
"dictionary",
"python"
] | stackoverflow_0003337512_dictionary_python.txt |
Q:
Setting Return-Path with Python sendmail for a MIME message
Hi would like to set the "Return-Path" header for a MIME message I send with Python.
Basically, I tried something like this :
message = MIMEMultipart()
message.add_header("Return-Path", "something@something.com")
#...
smtplib.SMTP().sendmail(from, to, me... | Setting Return-Path with Python sendmail for a MIME message | Hi would like to set the "Return-Path" header for a MIME message I send with Python.
Basically, I tried something like this :
message = MIMEMultipart()
message.add_header("Return-Path", "something@something.com")
#...
smtplib.SMTP().sendmail(from, to, message.as_string())
The message I receive have its "Return-Path" ... | [
"Return-Path is set by the SMTP protocol, it's not derived from the message itself. It'll be the Envelope From address is most setups.\nThe proper way to accomplish this is:\nmsg = email.message_from_string('\\n'.join([\n 'To: michael@mydomain.com',\n 'From: michael@mydomain.com',\n 'Subject: test email',\... | [
4
] | [] | [] | [
"header",
"mime",
"python",
"return_path",
"smtplib"
] | stackoverflow_0003337055_header_mime_python_return_path_smtplib.txt |
Q:
Pythonic way to write two if-statements
I have two variables that are the result of regex searches.
a = re.search('some regex', str)
b = re.search('different regex', str)
This should return a re object. If they are not None, I want to use the group() method to get the string that it matched. This is the code I a... | Pythonic way to write two if-statements | I have two variables that are the result of regex searches.
a = re.search('some regex', str)
b = re.search('different regex', str)
This should return a re object. If they are not None, I want to use the group() method to get the string that it matched. This is the code I am using right now to do this:
if a != None:
... | [
"Don't shadow the built-in str, and say\nif a:\n\ninstead of\nif a != None\n\nNot much else to improve imho.\n",
"a = a.group() if a else None\n",
"If you really must have a one-liner:\na, b = a.group() if a else None, b.group() if b else None\n\n",
"As I commented, I prefer not to reuse a and b for both the ... | [
5,
4,
2,
2,
0
] | [] | [] | [
"python",
"regex"
] | stackoverflow_0003337128_python_regex.txt |
Q:
Why is django.test.client.Client not keeping me logged in
I'm using django.test.client.Client to test whether some text shows up when a user is logged in. However, I the Client object doesn't seem to be keeping me logged in.
This test passes if done manually with Firefox but not when done with the Client object.
... | Why is django.test.client.Client not keeping me logged in | I'm using django.test.client.Client to test whether some text shows up when a user is logged in. However, I the Client object doesn't seem to be keeping me logged in.
This test passes if done manually with Firefox but not when done with the Client object.
class Test(TestCase):
def test_view(self):
user.set... | [
"Just happened to me when retesting an app that has been working and forgotten for some months.\nThe solution (apart from updating to Django 1.2) is Patch #11821. In short, Python 2.6.5 has some bugfix in the Cookie module, triggering an edge case bug in the test client.\n",
"I use RequestContext to get the logg... | [
1,
0,
0
] | [] | [] | [
"automated_tests",
"django",
"python",
"testing",
"unit_testing"
] | stackoverflow_0002878602_automated_tests_django_python_testing_unit_testing.txt |
Q:
Personal archive tool, looking for suggestions on improving the code
i've written a tool in python where you enter a title, content, then tags, and the entry is then saved in a pickle file. it was mainly designed for copy-paste functionality (you spot a piece of code you like on the net, copy it, and paste it into... | Personal archive tool, looking for suggestions on improving the code | i've written a tool in python where you enter a title, content, then tags, and the entry is then saved in a pickle file. it was mainly designed for copy-paste functionality (you spot a piece of code you like on the net, copy it, and paste it into the program), not really for handwritten content, though it does that wit... | [
"In the else, you call the main function again recursively. Instead, I'd do something like choice == \"0\", which will just cause the while loop to request another entry. This avoids a pointless recursion.\n"
] | [
1
] | [] | [] | [
"archive",
"code_snippets",
"python"
] | stackoverflow_0003338088_archive_code_snippets_python.txt |
Q:
Python - Using os.popen() to parse Unix "ls" - Problems with Killing Child Process
From my understanding, os.popen() opens a pipe within Python and initiates a new sub process. I have a problem when I run a for loop in conjunction with os.popen(). I can't seem to CTRL+C out of the loop. Here is my code:
for FIL... | Python - Using os.popen() to parse Unix "ls" - Problems with Killing Child Process | From my understanding, os.popen() opens a pipe within Python and initiates a new sub process. I have a problem when I run a for loop in conjunction with os.popen(). I can't seem to CTRL+C out of the loop. Here is my code:
for FILE in os.popen("ls $MY_DIR/"):
os.system("./processFile " + FILE)
Whenever I try to ... | [
"I see some answer correctly recommended subprocess.check_call and the OP in a comment said\n\nI'm getting this error:\n AttributeError: 'module' object has no\n attribute 'check_call'\n\nPer the docs I just linked to, check_call is marked as:\n\nNew in version 2.5.\n\nso it looks like the OP is using some ancien... | [
3,
2
] | [] | [] | [
"c",
"centos",
"ctrl",
"linux",
"python"
] | stackoverflow_0003338033_c_centos_ctrl_linux_python.txt |
Q:
Various queries - MongoDB
This is my table:
unicorns = {'name':'George',
'actions':[{'action':'jump', 'time':123123},
{'action':'run', 'time':345345},
...]}
How can I perform the following queries?
Grab the time of all actions of all unicorns where ... | Various queries - MongoDB | This is my table:
unicorns = {'name':'George',
'actions':[{'action':'jump', 'time':123123},
{'action':'run', 'time':345345},
...]}
How can I perform the following queries?
Grab the time of all actions of all unicorns where action=='jump' ?
Grab all actio... | [
"Use dot-separated notation:\ndb.unicorns.find({'actions.action' : 'jump'})\n\nSimilarly for times:\ndb.unicorns.find({'actions.time' : 123})\n\nEdit: if you want to group the results by time, you'll have to use MapReduce.\n",
"For the second query, you need to use MapReduce, which can get a big hairy. This will ... | [
2,
2
] | [] | [] | [
"django",
"mongodb",
"nosql",
"pymongo",
"python"
] | stackoverflow_0003330637_django_mongodb_nosql_pymongo_python.txt |
Q:
Does nesting affect efficiency?
Consider languages like Python or JavaScript that allow functions to be nested like this:
print(vector(a * b),(a * c),(b * c)))
or flat like this:
i = (a * b)
j = (a * c)
k = (b * c)
V = vector(i,j,k)
print(V)
How much does the different format affect performance? Can valid genera... | Does nesting affect efficiency? | Consider languages like Python or JavaScript that allow functions to be nested like this:
print(vector(a * b),(a * c),(b * c)))
or flat like this:
i = (a * b)
j = (a * c)
k = (b * c)
V = vector(i,j,k)
print(V)
How much does the different format affect performance? Can valid generalizations be made, or does it vary a ... | [
"Any function call adds a small number of machine instructions, including more for more parameters, compared to the same code being present inline, or the compile treating the function as inline.\nHowever, it is a VERY small number of machine instructions. So, in most cases you can easily make that back by for any ... | [
3,
2
] | [] | [] | [
"coding_style",
"javascript",
"nested",
"performance",
"python"
] | stackoverflow_0003337861_coding_style_javascript_nested_performance_python.txt |
Q:
Decrypting a gpg file with gnupg
I'm trying to decrypt some data from gpg files that I've downloaded. Downloading the files to a directory is no problem, but I'm having trouble actually decrypting them. Here's what I'm doing right now:
def extractGPGs(gpglist,path,gpgPath="\"C:\\Program Files\\GNU\\GnuPG\\gpg.exe\... | Decrypting a gpg file with gnupg | I'm trying to decrypt some data from gpg files that I've downloaded. Downloading the files to a directory is no problem, but I'm having trouble actually decrypting them. Here's what I'm doing right now:
def extractGPGs(gpglist,path,gpgPath="\"C:\\Program Files\\GNU\\GnuPG\\gpg.exe\""):
os.chdir(path)
if not os.path.is... | [
"Maybe you need the output to be a file name instead of a directory.\n"
] | [
2
] | [] | [] | [
"encryption",
"gnupg",
"python"
] | stackoverflow_0003338485_encryption_gnupg_python.txt |
Q:
Python Permutation code
Started to learn programming 2 months ago, in one of my little projects i encountered the need to generate permutations of list of objects.
I knew that i'll find how to do this if i'll just searched for it, but i wanted to make one of my own, so i worked up and made my own permutation gener... | Python Permutation code | Started to learn programming 2 months ago, in one of my little projects i encountered the need to generate permutations of list of objects.
I knew that i'll find how to do this if i'll just searched for it, but i wanted to make one of my own, so i worked up and made my own permutation generator code:
def perm(lst, c = ... | [
">>> from itertools import permutations\n>>> list(permutations(range(2)))\n[(0, 1), (1, 0)]\n>>> list(permutations([1, 4, 5]))\n[(1, 4, 5), (1, 5, 4), (4, 1, 5), (4, 5, 1), (5, 1, 4), (5, 4, 1)]\n\nIn the docs there is Python code available for legacy versions.\nA note re your code, x + 1 doesn't do anything as you... | [
3,
3,
2,
1,
0,
0
] | [] | [] | [
"python"
] | stackoverflow_0003336862_python.txt |
Q:
How do I use pylons (paste) webtest with multiple checkboxes with the same name?
Suppose I have a form like this:
<form id='myform'>
Favorite colors?
<input type='checkbox' name='color' value='Green'>Green
<input type='checkbox' name='color' value='Blue'>Blue
<input type='checkbox' name='color' val... | How do I use pylons (paste) webtest with multiple checkboxes with the same name? | Suppose I have a form like this:
<form id='myform'>
Favorite colors?
<input type='checkbox' name='color' value='Green'>Green
<input type='checkbox' name='color' value='Blue'>Blue
<input type='checkbox' name='color' value='Red'>Red
<input type='submit' value='Submit'>
</form>
How do I use webtest's ... | [
"Not sure about the form library, but you could use a MultiDict (you might have to use UnicodeMultiDict in some cases, I'm not sure).\nfrom webob.multidict import MultiDict\n\nclass TestSomeController(TestController):\n\n def test_something(self):\n params = MultiDict()\n params.add('some_param', '... | [
4
] | [] | [] | [
"paste",
"pylons",
"python",
"webob",
"webtest"
] | stackoverflow_0003337736_paste_pylons_python_webob_webtest.txt |
Q:
Python: get currently logged user and his/her special folders
Does this code win32api.GetUserName() works fine on all win system from win 2000 to win 7 ?
What about if user is not local user but domain user, does it still work ?
When i use this function shell.SHGetFolderPath(0, shellcon.CSIDL_someDirectory, 0, 0... | Python: get currently logged user and his/her special folders | Does this code win32api.GetUserName() works fine on all win system from win 2000 to win 7 ?
What about if user is not local user but domain user, does it still work ?
When i use this function shell.SHGetFolderPath(0, shellcon.CSIDL_someDirectory, 0, 0), do I get wanted folder for currently logged user ?
Any help ap... | [
"There is a module called getpass which has a getpass.getuser() function. \nThis should work on all windows versions. It did on all the versions I've tried anyway. The user I've used wasn't local either.\n"
] | [
2
] | [] | [] | [
"python",
"pywin32",
"windows"
] | stackoverflow_0003339191_python_pywin32_windows.txt |
Q:
getting started with processing data with python
i have an excel spreadsheet of about 3 million cells. i asked the following question and i liked the answer about saving the spreadsheet as CSV and then processing it with python:
solution to perform lots of calculations on 3 million data points and make charts
is ... | getting started with processing data with python | i have an excel spreadsheet of about 3 million cells. i asked the following question and i liked the answer about saving the spreadsheet as CSV and then processing it with python:
solution to perform lots of calculations on 3 million data points and make charts
is there a library that i can use that will read the csv ... | [
"I like NumPy's loadtxt for this sort of thing. Very configurable for reading CSVs. And savetxt for putting it back after manipulation. Or you could check out the built in csv module if you'd rather not install anything new.\n",
"\nis there a library that i can use that will read the csv into a matrix or shoul... | [
3,
3,
1,
1
] | [] | [] | [
"excel",
"python",
"vba"
] | stackoverflow_0003338567_excel_python_vba.txt |
Q:
Can this image processing code be optimised to use less memory?
I have a python function that takes a string s-expression like "(add (sub 10 5) 5)", where "add" and "sub" are actually image processing functions, and evaluates and creates the image represented in the string. The image processing functions take cons... | Can this image processing code be optimised to use less memory? | I have a python function that takes a string s-expression like "(add (sub 10 5) 5)", where "add" and "sub" are actually image processing functions, and evaluates and creates the image represented in the string. The image processing functions take constants, variables, or other images (represented as lists of vectors), ... | [
"Profiling can tell you where the program is spending most of its time.\nSecond, is str(sList[index-1]) converting an Image into a string? Does ip.token(...) return an Image? If so, you are converting between string and Image a number of times. That might be very slow.\nIt might help to change\nrawImage = eval(\"ip... | [
2,
0
] | [] | [] | [
"image_processing",
"memory_management",
"python",
"python_imaging_library",
"s_expression"
] | stackoverflow_0003339728_image_processing_memory_management_python_python_imaging_library_s_expression.txt |
Q:
error: ambiguous overload for 'operator/'
I am new to c, and the following is giving me some grief:
int i,j,ll,k;
double ddim,ddip,ddjm,ddjp,ddlm,ddlp;
for(i=1; i<(mx-1); i++){
for(j=1; j<(my-1); j++){
for(ll=1; ll<(mz-1); ll++){
ddim=0.5*k
ddip=0.5*k
ddjm=0.5*k
ddjp=0.5*k
ddlm=0.5*k
ddlp=0.5*k
Wijl(i,j... | error: ambiguous overload for 'operator/' | I am new to c, and the following is giving me some grief:
int i,j,ll,k;
double ddim,ddip,ddjm,ddjp,ddlm,ddlp;
for(i=1; i<(mx-1); i++){
for(j=1; j<(my-1); j++){
for(ll=1; ll<(mz-1); ll++){
ddim=0.5*k
ddip=0.5*k
ddjm=0.5*k
ddjp=0.5*k
ddlm=0.5*k
ddlp=0.5*k
Wijl(i,j,ll) = ((1.0/h_x)*(ddip) \
((1.0/h_x)*(dd... | [
"I think it's trying to say that it's not clear what type h_x is, so it doesn't know which of the overloaded / operators to use (double/int, double/double, etc). You could try casting it (h_x) to int or double to tell it what version to use.\n",
"If h_x is float then dividing 1.0 (by default double) by it leaves ... | [
1,
0,
0
] | [] | [] | [
"c",
"math",
"numpy",
"overloading",
"python"
] | stackoverflow_0003338125_c_math_numpy_overloading_python.txt |
Q:
Architecting from scratch in Python: what to use?
I'm lucky enough to have full control over the architecture of my company's app, and I've decided to scrap our prototype written in Ruby/Rails and start afresh in Python. This is for a few reasons: I want to learn Python, I prefer the syntax and I've basically said... | Architecting from scratch in Python: what to use? | I'm lucky enough to have full control over the architecture of my company's app, and I've decided to scrap our prototype written in Ruby/Rails and start afresh in Python. This is for a few reasons: I want to learn Python, I prefer the syntax and I've basically said "F**k it, let's do it."
So, baring in mind this is goi... | [
"Frameworks\nOK, so I'm a little biased here as I currently make extensive use of Django and organise the Django User Group in London so bear that in mind when reading the following.\nStart with Django because it's a great gateway drug. Lots of documentation and literature, a very active community of people to talk... | [
29,
14,
4,
0
] | [] | [] | [
"frameworks",
"orm",
"python",
"rest"
] | stackoverflow_0003143115_frameworks_orm_python_rest.txt |
Q:
When download an image, does urllib have a return code if it's successful or not?
I want to download an image file from potentially 5 sites.
Meaning that if the image wasn't found in site#1, try site#2, etc.
How can I test if the file was downloaded?
A:
You can call getcode() on the object you get back from urlo... | When download an image, does urllib have a return code if it's successful or not? | I want to download an image file from potentially 5 sites.
Meaning that if the image wasn't found in site#1, try site#2, etc.
How can I test if the file was downloaded?
| [
"You can call getcode() on the object you get back from urlopen().\ngetcode() gives you the HTTP status response from the server, so you can test to see if you got an HTTP 200 response, which would mean the download was successful.\n"
] | [
3
] | [] | [] | [
"python",
"urllib"
] | stackoverflow_0003340152_python_urllib.txt |
Q:
post to page to login using beautiful soup
I'm using python and beautifulsoup (new to both!), and I want to login to a suppliers website.
So their form looks like (simplified):
<form name=loginform action=/index.html method="post">
<input name=user>
<input name=pass">
</form>
Is there a way to keep track for co... | post to page to login using beautiful soup | I'm using python and beautifulsoup (new to both!), and I want to login to a suppliers website.
So their form looks like (simplified):
<form name=loginform action=/index.html method="post">
<input name=user>
<input name=pass">
</form>
Is there a way to keep track for cookies?
| [
"Do some more reading. \nRead about urllib2 That's what you use to do a POST to login. If you know the <input> names, you don't need Beautiful Soup. http://docs.python.org/library/urllib2.html\nBeautiful Soup is what you use to parse a page of results. After you login. After you post the real request.\n",
"U... | [
9,
8
] | [] | [] | [
"beautifulsoup",
"python"
] | stackoverflow_0003340190_beautifulsoup_python.txt |
Q:
python csv: getting subset
here is a snapshot of my csv:
alex 123f 1
harry fwef 2
alex sef 3
alex gsdf 4
alex wf35 6
harry sdfsdf 3
i would like to get the subset of this data where the occurrence of anything in the first column (harry, alex) is at least 4. so i want the resulting dat... | python csv: getting subset | here is a snapshot of my csv:
alex 123f 1
harry fwef 2
alex sef 3
alex gsdf 4
alex wf35 6
harry sdfsdf 3
i would like to get the subset of this data where the occurrence of anything in the first column (harry, alex) is at least 4. so i want the resulting data set to be:
alex 123f 1
a... | [
"Clearly, you cannot decide which rows are interesting until you've seen all rows (since the very last row might be the one turning some count from three to four and thereby making some previously seen rows interesting, for example;-). So, unless your CSV file is horribly huge, suck it all into memory, first, as a... | [
5,
1
] | [] | [] | [
"csv",
"python"
] | stackoverflow_0003339694_csv_python.txt |
Q:
with beautifulsoup, how to reference the first table after a given form
I want to drill down into my html, specifically I want to get the first html table that is AFTER a form that looks like:
<form method="POST" action="/parts.html">
..
<table ...>
...
</table>
..
</form>
So this table has <tr> for each pro... | with beautifulsoup, how to reference the first table after a given form | I want to drill down into my html, specifically I want to get the first html table that is AFTER a form that looks like:
<form method="POST" action="/parts.html">
..
<table ...>
...
</table>
..
</form>
So this table has <tr> for each product.
My utlimate goal here is to loop through each tablerow, and then I need... | [
"Keep reading. \nhttp://www.crummy.com/software/BeautifulSoup/documentation.html#Iterating%20over%20a%20Tag\nhttp://www.crummy.com/software/BeautifulSoup/documentation.html#nextSibling%20and%20previousSibling\n"
] | [
1
] | [] | [] | [
"beautifulsoup",
"python"
] | stackoverflow_0003340329_beautifulsoup_python.txt |
Q:
Is it possible to have python open a terminal and write to it?
For example, if I have this code:
subprocess.call(['gnome-terminal'])
Is it possible to have python output strings to that specific terminal that was just opened? Thanks!
A:
Possibly, but it is easier to have a custom process running in the subordin... | Is it possible to have python open a terminal and write to it? | For example, if I have this code:
subprocess.call(['gnome-terminal'])
Is it possible to have python output strings to that specific terminal that was just opened? Thanks!
| [
"Possibly, but it is easier to have a custom process running in the subordinate terminal. For example, given sserv.py from the example server in the documentation the command:\n gnome-terminal -e \"python ./sserv.py\"\n\nwill happily chat on port 9999 with you. Given a more complex sserv.py it could do anything you... | [
3,
2
] | [] | [] | [
"gnome_terminal",
"linux",
"python"
] | stackoverflow_0003340341_gnome_terminal_linux_python.txt |
Q:
Python3.0 TypeError
Usually one comes across this problem in python3.0 while attempting a split() method on a bytes type object.
TypeError: Type str does'nt support the buffer API
This issue can be resolved by using the split method after decoding the bytes type object.
However, I find the error message rather a... | Python3.0 TypeError | Usually one comes across this problem in python3.0 while attempting a split() method on a bytes type object.
TypeError: Type str does'nt support the buffer API
This issue can be resolved by using the split method after decoding the bytes type object.
However, I find the error message rather ambiguous. Am I missing so... | [
"Just forget the existence of totally-obsolete, zero-reasons-to-keep-it-around 3.0, upgrade to 3.1 instead, and splitting bytes is just fine:\n>>> x = bytes(b'ciao bella')\n>>> x.split()\n[b'ciao', b'bella']\n\n"
] | [
9
] | [] | [] | [
"python",
"python_3.x"
] | stackoverflow_0003340712_python_python_3.x.txt |
Q:
GUI's Over Running Programs in python
Just wondering if there is any kind of framework or method of making a Gui that will override (Stay on top of) all other windows in python. Including Games or other programs that seem to "Take over" the computers Graphical processes. Any point in the right direction would be m... | GUI's Over Running Programs in python | Just wondering if there is any kind of framework or method of making a Gui that will override (Stay on top of) all other windows in python. Including Games or other programs that seem to "Take over" the computers Graphical processes. Any point in the right direction would be much appreciated...
PS. The OS in question i... | [
"You need the SetWindowPos function from the Win32 API. Something like the following should work (see the API link for more details):\nimport win32gui, win32con\n\nhwnd = get_my_window_handle()\nwin32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 0, 0, 0, 0, win32con.SWP_NOMOVE | win32con.SWP_NOSIZE)\n\n",
"For a... | [
0,
0
] | [] | [] | [
"python",
"user_interface"
] | stackoverflow_0003340639_python_user_interface.txt |
Q:
saving data and calling data python
say i want to ask the many users to give me their ID number and their name, than save it.
and than i can call any ID and get the name. can someone tell me how i can do that by making a class and using the _ _ init _ _ method?
A:
The "asking" part, as @Zonda's answer says, co... | saving data and calling data python | say i want to ask the many users to give me their ID number and their name, than save it.
and than i can call any ID and get the name. can someone tell me how i can do that by making a class and using the _ _ init _ _ method?
| [
"The \"asking\" part, as @Zonda's answer says, could use raw_input (or Python 3's input) at a terminal (\"command window\" in Windows); but it could also use a web application, or a GUI application -- you don't really tell us enough about where the users will be (on the same machine you're using to run your code, o... | [
2,
1,
1
] | [] | [] | [
"python"
] | stackoverflow_0003340803_python.txt |
Q:
How can I upgrade the sqlite3 package in Python 2.6?
I was using Python 2.6.5 to build my application, which came with sqlite3 3.5.9. Apparently though, as I found out in another question of mine, foreign key support wasn't introduced in sqlite3 until version 3.6.19. However, Python 2.7 comes with sqlite3 3.6.21, ... | How can I upgrade the sqlite3 package in Python 2.6? | I was using Python 2.6.5 to build my application, which came with sqlite3 3.5.9. Apparently though, as I found out in another question of mine, foreign key support wasn't introduced in sqlite3 until version 3.6.19. However, Python 2.7 comes with sqlite3 3.6.21, so this work -- I decided I wanted to use foreign keys in ... | [
"download the latest version of sqlite3.dll from sqlite website and replace the the sqlite3.dll in the python dir.\n",
"sqlite3 is not a built-in module; it's an extension module (the binary is C:\\Python26\\DLLs_sqlite3.pyd (on my machine)). A pyd is a DLL with a different filename extension and only 1 entry poi... | [
6,
3,
1
] | [] | [] | [
"build",
"linker",
"python",
"sqlite"
] | stackoverflow_0003333095_build_linker_python_sqlite.txt |
Q:
Filtering in Python/Django based on date, ignoring time
I'd like to filter objects to the day with datetime, but can't find examples on how to do this anywhere.
This, for example, works perfectly in pulling together all following events:
@login_required
def invoice_picker(request):
"""Grab a date from the URL ... | Filtering in Python/Django based on date, ignoring time | I'd like to filter objects to the day with datetime, but can't find examples on how to do this anywhere.
This, for example, works perfectly in pulling together all following events:
@login_required
def invoice_picker(request):
"""Grab a date from the URL and show all the invoicable deliveries for that day."""
q... | [
"I don't think there's a good way to compare datetimes with dates. One way is the following:\nfilter(end__year=date.year, end__month=date.month, end__day=date.day)\n\nThe other is to use the range lookup with the min time and max time for the day.\n"
] | [
8
] | [] | [] | [
"datetime_format",
"django",
"python"
] | stackoverflow_0003341120_datetime_format_django_python.txt |
Q:
Is there Python Clang wrapper in the vein of pygccxml which wraps GCC-XML?
For a long time now I've been using pygccxml to parse and introspect my C++ source code: it helps me to do some clever code-generation during our build process.
Recently I've read a lot about the benefits of the LLVM stack, and especially t... | Is there Python Clang wrapper in the vein of pygccxml which wraps GCC-XML? | For a long time now I've been using pygccxml to parse and introspect my C++ source code: it helps me to do some clever code-generation during our build process.
Recently I've read a lot about the benefits of the LLVM stack, and especially the benefits that the LLVM Clang parser brings to C++ compilation. I am now wond... | [
"After further digging I found that in the LLVM 2.7 release there could be the beginings of something useful:\n\nIn the LLVM 2.7 time-frame, the Clang team has made many improvements....\nCIndex API and Python bindings: Clang now includes a C API as part of the CIndex library. Although we make make some changes to ... | [
5
] | [] | [] | [
"c++",
"clang",
"code_generation",
"llvm",
"python"
] | stackoverflow_0003334170_c++_clang_code_generation_llvm_python.txt |
Q:
Python OpenGL module - can't render basic triangle
I'm trying to use the OpenGL module with Python.
Here is my source:
pygame.init()
screen = pygame.display.set_mode((800, 600), HWSURFACE|OPENGL|DOUBLEBUF)
def init():
glEnable(GL_DEPTH_TEST)
glShadeModel(GL_FLAT)
glClearColor(1.0, 1.0, 1.... | Python OpenGL module - can't render basic triangle | I'm trying to use the OpenGL module with Python.
Here is my source:
pygame.init()
screen = pygame.display.set_mode((800, 600), HWSURFACE|OPENGL|DOUBLEBUF)
def init():
glEnable(GL_DEPTH_TEST)
glShadeModel(GL_FLAT)
glClearColor(1.0, 1.0, 1.0, 0.0)
glEnable(GL_COLOR_MATERIAL)
g... | [
"You need to setup view and projection matrices.\nhttp://www.opengl.org/resources/faq/technical/transformations.htm#tran0090\n"
] | [
1
] | [] | [] | [
"opengl",
"python"
] | stackoverflow_0003340732_opengl_python.txt |
Q:
How to set fixed depth levels in DOT graphs
I'm creating a DOT graph visualization from a tree-like data structure but am having difficulties setting fixed level depths based upon data type. For example, if I had 4 nodes in a tree and A denotes a specific data type and B represents another it would like Graph_1:... | How to set fixed depth levels in DOT graphs | I'm creating a DOT graph visualization from a tree-like data structure but am having difficulties setting fixed level depths based upon data type. For example, if I had 4 nodes in a tree and A denotes a specific data type and B represents another it would like Graph_1:
ROOT ... | [
"Yes, subgraphs will work.\ndigraph {\n subgraph { rank = same; A0 };\n subgraph { rank = same; B0; B1 };\n root -> A0;\n A0 -> B0;\n root -> B1;\n}\n\nresults in\n\n(source: brool.com) \n"
] | [
4
] | [] | [] | [
"dot",
"graphviz",
"macos",
"python"
] | stackoverflow_0003322827_dot_graphviz_macos_python.txt |
Q:
CPython vs. Jython vs. IronPython for cross-platform GUI development
I'm thinking of making some kind of experimental IDE for digital hardware design. So I can't decide witch platform to choose.
I'm going to have text-editor with syntax highlighting, some vector graphics and lots of tabbed windows.
My goals:
1. to... | CPython vs. Jython vs. IronPython for cross-platform GUI development | I'm thinking of making some kind of experimental IDE for digital hardware design. So I can't decide witch platform to choose.
I'm going to have text-editor with syntax highlighting, some vector graphics and lots of tabbed windows.
My goals:
1. to make GUI using as less custom components as possible.
2. to make it as cr... | [
"IronPython with Mono is cross platform - to whatever platforms supported by Mono, and for the feature set supported by Mono (which pretty much means Windows Forms is supported fairly well). Other options for GUI toolkits are available, however, which may provide better \"cross platform\" capabilities, or at least... | [
9,
5,
5,
3,
2,
2,
1,
1
] | [] | [] | [
"cpython",
"ironpython",
"jython",
"python",
"user_interface"
] | stackoverflow_0003337725_cpython_ironpython_jython_python_user_interface.txt |
Q:
Python/Web: What's the best way to run Python on a web server?
I am leasing a dedicated web server.
I have a Python web-application.
Which configuration option (CGI, FCGI, mod_python, Passenger, etc) would result in Python being served the fastest on my web server and how do I set it up that way?
UPDATE:
Note, I'm... | Python/Web: What's the best way to run Python on a web server? | I am leasing a dedicated web server.
I have a Python web-application.
Which configuration option (CGI, FCGI, mod_python, Passenger, etc) would result in Python being served the fastest on my web server and how do I set it up that way?
UPDATE:
Note, I'm not using a Python framework such as Django or Pylons.
| [
"I usually go the Apache + mod_wsgi route. It is pretty easy to set up.\nTo answer your question about speed, I pulled this from the provided link:\n\nThe mod_wsgi module is written in C code directly against the internal Apache and Python application programming interfaces. As such, for hosting WSGI applications i... | [
8,
4,
1,
0,
0
] | [
"You don't usually just serve Python, you serve a specific web server or framework based on Python. eg. Zope, TurboGears, Django, Pylons, etc. Although they tend to be able to operate on different web server back-ends (and some provide an internal web server themselves), the best solution will depend on which one y... | [
-1
] | [
"mod_wsgi",
"python",
"webserver"
] | stackoverflow_0003336787_mod_wsgi_python_webserver.txt |
Q:
How to call a static methods on a django model class during a south migration
I'm writing a data migration in south to fix some denormalized data I screwed up in earlier code. The way to figure out the right value for the incorrect field is to call a static method on the django model class. The code looks like t... | How to call a static methods on a django model class during a south migration | I'm writing a data migration in south to fix some denormalized data I screwed up in earlier code. The way to figure out the right value for the incorrect field is to call a static method on the django model class. The code looks like this:
class Account(models.Model):
name = models.CharField()
@staticmethod
... | [
"You can't use methods from models.py in south migrations. The reason is that in the future models.py will evolve and sooner or later you will delete those methods, then migration will be broken.\nYou should put all code needed by migration in migration file itself.\n",
"Here's the pertinent section of the South ... | [
43,
7,
1
] | [] | [] | [
"django",
"django_south",
"python"
] | stackoverflow_0003314173_django_django_south_python.txt |
Q:
python FLV checker
i need a simple python lib that check the uploaded files to my webserver are flash media (FLV), by reading the flv header (metadata) and not the mimetype extension.
A:
Kaa is simple to use and quite powerful as well.
Right away:
>>> import kaa.metadata
>>> info = kaa.metadata.parse('tlib_allie... | python FLV checker | i need a simple python lib that check the uploaded files to my webserver are flash media (FLV), by reading the flv header (metadata) and not the mimetype extension.
| [
"Kaa is simple to use and quite powerful as well.\nRight away:\n>>> import kaa.metadata\n>>> info = kaa.metadata.parse('tlib_allie_jordan-sd169.wmv')\n>>> print info\n| type: asf format\n| media: MEDIA_AV\n| mime: video/x-ms-asf\n| length: 1871.166\n+-- Video Track #1\n| | media: MEDIA_... | [
5
] | [] | [] | [
"flash",
"flv",
"metadata",
"python"
] | stackoverflow_0003341461_flash_flv_metadata_python.txt |
Q:
Extract a specific portion of connection string
Any way to extract what's after the @(if any) and before the next . (if any)?
Examples:
host
host.domain.com
user@host
first.last@host
first.last@host.domain.com
first@host.domain.com
I need to get host in a variable.
Suggestions in Python? Any method is welcomed.
T... | Extract a specific portion of connection string | Any way to extract what's after the @(if any) and before the next . (if any)?
Examples:
host
host.domain.com
user@host
first.last@host
first.last@host.domain.com
first@host.domain.com
I need to get host in a variable.
Suggestions in Python? Any method is welcomed.
Thanks,
EDIT: I fixed my question. Need to match host ... | [
"You can use a couple of string.split calls, the first using '@' as a separator, the second using '.'\n",
"do a split by '@', and then substring.\n",
">>> x = \"first.last@host.domain.com\"\n>>> x.split(\"@\")[1].split(\".\")[0]\n'host'\n>>> y = \"first.last@host\"\n>>> y.split(\"@\")[1].split(\".\")[0]\n'host'... | [
1,
0,
0,
0,
0,
0,
0,
0
] | [] | [] | [
"connection_string",
"python",
"regex",
"string"
] | stackoverflow_0003341557_connection_string_python_regex_string.txt |
Q:
Python SESSION (like php) class
is there any class to handle a SESSION (like php) in Python? not in django, but I want to use it with PyQt
thank you
A:
The short answer is that there is no $SESSION variable in Python.
Python tends not to put things in global scope like PHP. Therefore, if you are accessing a user... | Python SESSION (like php) class | is there any class to handle a SESSION (like php) in Python? not in django, but I want to use it with PyQt
thank you
| [
"The short answer is that there is no $SESSION variable in Python.\nPython tends not to put things in global scope like PHP. Therefore, if you are accessing a user's session id, it will probably be accessed via dot notation module_name.ClassName.session. If you would like to create a PyQt app that acts as a webserv... | [
2,
0
] | [] | [] | [
"class",
"pyqt",
"python",
"session"
] | stackoverflow_0003341298_class_pyqt_python_session.txt |
Q:
how to upload python application with google apps?
I developed one application and upload on example.appspot.com
now i want to upload it on www.example.com
what to do???
pls reply fast..
A:
Actually, your application has to be hosted by GAE, but you can set a domain for it.
| how to upload python application with google apps? | I developed one application and upload on example.appspot.com
now i want to upload it on www.example.com
what to do???
pls reply fast..
| [
"Actually, your application has to be hosted by GAE, but you can set a domain for it.\n"
] | [
3
] | [] | [] | [
"dns",
"google_app_engine",
"python",
"upload",
"web"
] | stackoverflow_0003341899_dns_google_app_engine_python_upload_web.txt |
Q:
Installing PIL on Snow Leopard -- NOTHING WORKS
I'm trying to install PIL on Snow Leopard, using Python 2.6.1, GCC 4.2.1, PIL 1.1.7, and have tried with both libjpeg6b and libjpeg7 -- nothing works. I've cleared out every trace of libjpeg/pil/zlib from fink, tried various compiler options, etc. and used http://jet... | Installing PIL on Snow Leopard -- NOTHING WORKS | I'm trying to install PIL on Snow Leopard, using Python 2.6.1, GCC 4.2.1, PIL 1.1.7, and have tried with both libjpeg6b and libjpeg7 -- nothing works. I've cleared out every trace of libjpeg/pil/zlib from fink, tried various compiler options, etc. and used http://jetfar.com/libjpeg-and-python-imaging-pil-on-snow-leopar... | [
"I recently wrote an article on how to get PIL, django, libjpeg to work nicely alongside Snow Leopard\nhttp://appelfreelance.com/2010/06/libjpeg-pil-snow-leopard-python2-6-_jpeg_resync_to_restart/\nI'll copy it in here for you too.\nIf you don’t have this download it first.\n\nhttp://www.ijg.org/files/jpegsrc.v7.ta... | [
5,
1,
0
] | [] | [] | [
"gcc",
"libjpeg",
"osx_snow_leopard",
"python",
"python_imaging_library"
] | stackoverflow_0003224628_gcc_libjpeg_osx_snow_leopard_python_python_imaging_library.txt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.