>>> from pprint import pprint
>>> a = Account.objects.get(code='M201064001')
>>> pprint(a.report(ending='2012-02', length=3))
{'M201064001': {'2011-12': {'cons': 0.12,
'corp': 0.88,
'total': Decimal('900')},
'2012-01': {'cons': 0.12,
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿĂ㥹ĆćČčĎďĐđĘęĚěĹĺĽľŁłŃńŇňŐőŒœŔŕŘřŚśŞşŠšŢţŤťŮůŰűŸŹźŻżŽžƒˆˇ˘˙˛˜˝–—‘’‚“”„†‡•…‰‹›€™ |
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32 | |
Type "help", "copyright", "credits" or "license" for more information. | |
(InteractiveConsole) | |
>>> from django.conf import settings | |
>>> settings.LANGUAGE_CODE | |
'pt_BR' | |
>>> from django.contrib.auth.models import User | |
>>> from django.utils.translation import ugettext as _ | |
>>> User._meta.verbose_name | |
<django.utils.functional.__proxy__ object at 0x01686730> |
" Vim color file | |
" | |
" Author: André Terra <[email protected]> | |
" | |
" Note: Anthony Carapetis original version of github's syntax thmee | |
" with a few changes, like better .py highlighting and line #s. | |
" Used Brian Mock's darkspectrum as a starting point/template | |
" Thanks to Ryan Heath for an easy list of some of the colours: | |
" http://rpheath.com/posts/356-github-theme-for-syntax-gem |
" Vim syntax file | |
" Language: Python | |
" Maintainer: Neil Schemenauer <[email protected]> | |
" Last Change: 2010 Sep 21 | |
" Credits: Zvezdan Petkovic <[email protected]> | |
" Neil Schemenauer <[email protected]> | |
" Dmitry Vasiliev | |
" | |
" This version is a major rewrite by Zvezdan Petkovic. | |
" |
Option Explicit | |
Option Compare Text | |
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' | |
' modArraySupport | |
' By Chip Pearson, [email protected], www.cpearson.com | |
' | |
' This module contains procedures that provide information about and manipulate | |
' VB/VBA arrays. NOTE: These functions call one another. It is strongly suggested | |
' that you Import this entire module to a VBProject rather then copy/pasting | |
' individual procedures. |
body { | |
font-family: "Segoe UI", Arial; | |
} | |
.qwebirc-qui .lines { | |
color:#d9d9d9; background-color:#313131; | |
border-top: 1px solid #292929; | |
padding:0px 5px; | |
} | |
.qwebirc-qui .outertabbar { | |
border-bottom: 1px solid #202020; |
Original post at: http://pythonexcels.com/python-excel-mini-cookbook/
To get you started, I’ve illustrated a number of common tasks you can do with Python and Excel. Each program below is a self contained example, just copy it, paste it and run it. A few things to note:
These examples were tested in Excel 2007, they should work fine in earlier versions as well after changing the extension of the file within the wb.SaveAs()
statement from .xlsx to .xls
If you’re new to this, I recommend typing these examples by hand into IDLE, IPython or the Python interpreter, then watching the effect in Excel as you enter the commands. To make Excel visible add the line excel.Visible = True after the excel =win32.gencache.EnsureDispatch('Excel.Application')
line in the script
These are simple examples with no error checking. Make sure the output files doesn’t exist before running the script. If the script crashes, it may leave a copy of Excel running in the background. Open the Windows T
Const MAX_RESULTS_SIZE As Long = 100 | |
Public Function BaseLookup(ByVal Field As String, ParamArray Lookups() As Variant) As Variant | |
BaseLookup = FlexLookup_( _ | |
Caller:=Application.Caller, ShtName:="BASE", _ | |
Field:=Field, Grouped:=True, Sorted:=True, _ | |
RowLookup:=False, _ | |
ProtoLookups:=Lookups) |
# | |
# Copyright (C) 2013 Vinay Sajip. New BSD License. | |
# | |
import os | |
import os.path | |
from subprocess import Popen, PIPE | |
import sys | |
from threading import Thread | |
from urllib.parse import urlparse | |
from urllib.request import urlretrieve |