¡@

Home 

python Programming Glossary: demo

Iterating through a range of dates in Python

http://stackoverflow.com/questions/1060279/iterating-through-a-range-of-dates-in-python

I'm not actually using this to print. That's just for demo purposes. The start_date and end_date variables are datetime.date..

No module named _sqlite3

http://stackoverflow.com/questions/1210664/no-module-named-sqlite3

run a Django app on my VPS running Debian 5. When I run a demo app it comes back with this error File usr local lib python2.5..

Streaming data with Python and Flask

http://stackoverflow.com/questions/13386681/streaming-data-with-python-and-flask

def g yield doctype html title Send javascript snippets demo title style #data text align center style script src http code.jquery.com.. doctype html title Send javascript with template demo title style #data text align center style script src http code.jquery.com..

SQLite, python, unicode, and non-utf data

http://stackoverflow.com/questions/2392732/sqlite-python-unicode-and-non-utf-data

instead of the string.decode function. I wrote a demo function I will paste into the bottom of this gigantic mess.. the bottom of this gigantic mess that I hope correctly demonstrates the items in my list. Here is some of the output when.. of the output when I run the character 'ó' through the demo function showing how various methods react to the character..

Simple wrapping of C code with cython

http://stackoverflow.com/questions/3046305/simple-wrapping-of-c-code-with-cython

files cut paste the lot to one big file say cython numpy c demo then in Unix in a clean new directory run sh cython numpy c.. in Unix in a clean new directory run sh cython numpy c demo . # cat f.pyx # f.pyx numpy arrays extern from fc.h # 3..

NLTK and language detection

http://stackoverflow.com/questions/3182268/nltk-and-language-detection

thread a5f52af2cbc4cfeb pli 1 safe active Or the following demo file http code.google.com p nltk source browse trunk nltk_contrib..

Good examples of Python docstrings for Sphinx

http://stackoverflow.com/questions/4547849/good-examples-of-python-docstrings-for-sphinx

this question This page contains the source for a small demo project that uses automodule and autoclass http packages.python.org.. and sphinxy docstrings the latter use info field lists are demonstrated. The resulting output is here http packages.python.org..

Django: multiple models in one template using forms

http://stackoverflow.com/questions/569468/django-multiple-models-in-one-template-using-forms

2 cents 1 I found arguably the shortest and most concise demonstration of multiple model entry in single form here http collingrady.wordpress.com.. key before commiting save of child model. The link has the demo. 2 Maybe formsets can be beaten into doing this but as far as..

opencv python osx

http://stackoverflow.com/questions/5846745/opencv-python-osx

without errors. Step 2 I download ctypes opencv source and demo files . I navigate to the src directory and run sudo python..

SQLite Performance Benchmark — why is :memory: so slow…only 1.5X as fast as disk?

http://stackoverflow.com/questions/764710/sqlite-performance-benchmark-why-is-memory-so-slow-only-1-5x-as-fast-as-d

MEMORY ' c.execute 'PRAGMA journal_mode MEMORY ' # Make a demo table c.execute 'create table if not exists demo id1 int id2.. # Make a demo table c.execute 'create table if not exists demo id1 int id2 int val real ' c.execute 'create index id1_index.. id2 int val real ' c.execute 'create index id1_index on demo id1 ' c.execute 'create index id2_index on demo id2 ' for row..

Complex foreign key constraint in SQLAlchemy

http://stackoverflow.com/questions/8394177/complex-foreign-key-constraint-in-sqlalchemy

variable_id in addition to choice_id . Here is a working demo. Temporary tables so you can easily play with it CREATE TEMP..

Python prime generator in one-line

http://stackoverflow.com/questions/10639861/python-prime-generator-in-one-line

set range x 2 N x if x in r else r range 2 N set range 2 N Demo primesUpTo N lambda N reduce ... primesUpTo 30 2 3 5 7 11 13..

python takes list and returns only if negative value also exists using set

http://stackoverflow.com/questions/12887398/python-takes-list-and-returns-only-if-negative-value-also-exists-using-set

if x 0 numbers_with_negatives negatives.intersection data Demo data 3 2 1 2 1 4 negatives set x for x in data if x 0 negatives..

Streaming data with Python and Flask

http://stackoverflow.com/questions/13386681/streaming-data-with-python-and-flask

static index.html doctype html title Server Send Events Demo title style #data text align center style script src http code.jquery.com..

Return the first item in a list matching a condition [duplicate]

http://stackoverflow.com/questions/14366511/return-the-first-item-in-a-list-matching-a-condition

x None which will return None if nothing matches. Demo next x for x in range 10 if x 7 #This is a silly way to write..

How to write Pandas dataframe to sqlite with Index

http://stackoverflow.com/questions/14431646/how-to-write-pandas-dataframe-to-sqlite-with-index

# connect to a test DB with one three column table titled Demo con db.connect 'c Python27 test.db' wildcards ' '.join ' ' 3.. test.db' wildcards ' '.join ' ' 3 insert_sql 'INSERT INTO Demo VALUES s ' wildcards con.executemany insert_sql data Result..

Access python nested dictionary items via a list of keys

http://stackoverflow.com/questions/14692690/access-python-nested-dictionary-items-via-a-list-of-keys

use the last element to set the value to the right key. Demo getFromDict dataDict a r 1 getFromDict dataDict b v y 2 setInDict..

django-admin.py: command not found (bluehost server)

http://stackoverflow.com/questions/15671877/django-admin-py-command-not-found-bluehost-server

python gdb.py .hgtags Makefile Parser configure setup.py Demo Makefile.pre Python configure.in Doc Makefile.pre.in README..

Tkinter example code for multiple windows, why won't buttons load correctly?

http://stackoverflow.com/questions/16115378/tkinter-example-code-for-multiple-windows-why-wont-buttons-load-correctly

as tk from tkinter import from tkinter import ttk class Demo1 Frame def __init__ self tk.Frame.__init__ self self.pack self.master.title.. self tk.Frame.__init__ self self.pack self.master.title Demo 1 self.button1 Button self text Button 1 width 25 command.. 2 sticky W E N S def new_window self self.newWindow Demo2 class Demo2 Frame def __init__ self new tk.Frame.__init__ self..

When calling super() in a derived class, can I pass in self.__class__?

http://stackoverflow.com/questions/18208683/when-calling-super-in-a-derived-class-can-i-pass-in-self-class

print 'subclass of derived' super Subclass self .method Demo Subclass .method subclass of derived derived derived derived..

interleaving 2 lists of unequal lengths [duplicate]

http://stackoverflow.com/questions/19883826/interleaving-2-lists-of-unequal-lengths

StopIteration pending 1 nexts cycle islice nexts pending Demo list roundrobin xs ys 1 'hi' 2 'bye' 3 'no' 'yes' 'why' list..

Any Functional Programming method of traversing a nested dictionary?

http://stackoverflow.com/questions/20324830/any-functional-programming-method-of-traversing-a-nested-dictionary

from operator import getitem reduce getitem l d Demo d a b c 4 l a b c from operator import getitem reduce getitem..

How do I draw text at an angle using python's PIL?

http://stackoverflow.com/questions/245447/how-do-i-draw-text-at-an-angle-using-pythons-pil

This demo writes yellow text on a slant over an image # Demo to add rotated text to an image using PIL import Image import..

Print in terminal with colors using Python?

http://stackoverflow.com/questions/287871/print-in-terminal-with-colors-using-python

Dwarf Fortress Wiki see user made tilesets . The Text Mode Demo Contest has more resources for doing graphics in text mode...

Installing Python-2.7 on Ubuntu 10.4

http://stackoverflow.com/questions/4047212/installing-python-2-7-on-ubuntu-10-4

Python 2.7 Modules zlib home username sources Python 2.7 Demo zlib username@servername Thu Oct 28 18 43 17 ~ sources find..

Javascript equivalent of Python's zip function

http://stackoverflow.com/questions/4856717/javascript-equivalent-of-pythons-zip-function

_ i return arrays.map function array return array i Demo JSON.stringify zip 'abcde' 1 2 3 4 5 a 1 b 2 c 3 d 4 e 5 Or..

ANTLR parsing MismatchedTokenException

http://stackoverflow.com/questions/6359881/antlr-parsing-mismatchedtokenexception

grammar options language Python output AST backtrack true Demo A little demo of how to parse recursive expressions could look..

How to limit choice field options based on another choice field in django admin

http://stackoverflow.com/questions/796466/how-to-limit-choice-field-options-based-on-another-choice-field-in-django-admin

max_length 40 category models.ForeignKey Category class Demo models.Model name models.CharField max_length 40 category models.ForeignKey.. Item In the admin interface when creating a new Demo after user picks category from the dropdown I would like to..