background preloader

Python Documentation

Python Documentation

Python Tools for Visual Studio - Home Think Python Think Python is a concise introduction to software design using the Python programming language. Intended for people with no programming experience, this book starts with the most basic concepts and gradually adds new material. Some of the ideas students find most challenging, like recursion and object-oriented programming, are divided into a sequence of smaller steps and introduced over the course of several chapters. The focus is on the programming process, with special emphasis on debugging. Table of Contents Appendices Free ebook: Programming Windows 8 Apps with HTML, CSS, and JavaScript - Microsoft Press Added April 10, 2014: The second edition of this ebook, updated for Visual Studio 2013 and Windows 8.1, is posted here! Hello, Kraig Brockschmidt here. To help celebrate //build/, I’m delighted to announce the completion of Programming Windows 8 Apps with HTML, CSS, and JavaScript! You can download the ebook in PDF format here: EPUB format is here: MOBI format is here: The ebook’s companion content is here: This free ebook provides comprehensive coverage of the platform for Windows Store apps. It has been a wild ride these last few months to finish a book of this magnitude at the same time we were building up to the public release of Windows 8. In the end, then, there is much in this ebook that will be highly valuable to developers working on Windows 8 apps in whatever language. Below is the ebook’s Introduction, which gives you more details about the ebook.

PEP 8 -- Style Guide for Python Code Code should be written in a way that does not disadvantage other implementations of Python (PyPy, Jython, IronPython, Cython, Psyco, and such).For example, do not rely on CPython's efficient implementation of in-place string concatenation for statements in the form a += b or a = a + b. This optimization is fragile even in CPython (it only works for some types) and isn't present at all in implementations that don't use refcounting. In performance sensitive parts of the library, the ''.join() form should be used instead. This will ensure that concatenation occurs in linear time across various implementations.Comparisons to singletons like None should always be done with is or is not, never the equality operators.Also, beware of writing if x when you really mean if x is not None -- e.g. when testing whether a variable or argument that defaults to None was set to some other value. The other value might have a type (such as a container) that could be false in a boolean context!

The Python Script Collection For Windows - Automating Microsoft Outlook For Outlook automation it is nesseccary to use the makepy utility. You do this either from the tools menu of the Pythonwin-Editor (installed with Pywin32 or ActivePython) or you call the file c:\python23\Lib\site-packages\win32com\client\makepy.py. You then have to select the Outlook Object Library ("Microsoft Outlook 10.0 Object Library" for Office 10.0 or known as Office XP). After that Python generates cachefiles into the directory c:\python23\Lib\site-packages\win32com\gen_py or c:\temp\gen_py to tell Python more about the Outlook object library. Here is a well known example which dumps all adressbook entries from your default adressbook: codecs – String encoding and decoding The codecs module provides stream and file interfaces for transcoding data in your program. It is most commonly used to work with Unicode text, but other encodings are also available for other purposes. Unicode Primer CPython 2.x supports two types of strings for working with text data. When unicode strings are output, they are encoded using one of several standard schemes so that the sequence of bytes can be reconstructed as the same string later. The most common encodings for Western languages are UTF-8 and UTF-16, which use sequences of one and two byte values respectively to represent each character. See also For more introductory information about Unicode, refer to the list of references at the end of this section. Encodings The best way to understand encodings is to look at the different series of bytes produced by encoding the same string in different ways. $ python codecs_to_hex.py 61 62 63 64 65 66 6162 6364 6566 The result of encoding a unicode string is a str object. Note

Website Thumbnails with CSS — Boldewyn’s Website A thumb­nail view of a web­site is mean­while a com­mon sight. Google has re­cently in­tro­duced it in its search res­ults page, and nu­mer­ous ad ser­vices offer more or less an­noy­ing tool tips with page pre­views. What all these in­stances have in com­mon is the need for ren­der­ing the webpage in ques­tion on the server and dis­play­ing the image only to the cli­ent. The Tech­nique A thumb­nail is a mini­fied ver­sion of the ori­ginal. The above will render the ele­ment with ID #thumb at ⅓ of its ori­ginal size. The trick is now to apply this CSS to an iframe ele­ment. Since the cor­res­pond­ing CSS3 spe­cific­a­tions are not final yet, we have to set the known browser pre­fixes for the newer CSS prop­er­ties. En­han­cing with Javas­cript There is one major draw­back of the above simple CSS. We can rem­edy the first prob­lem, the flash­ing of the un­scaled Iframe, with Javas­cript quite simply. width: 320px; height: 160px; Auto-Thumb­nails It Could be more Power­ful A Final Note

Getting Started: Building a Chrome Extension Extensions allow you to add functionality to Chrome without diving deeply into native code. You can create new extensions for Chrome with those core technologies that you're already familiar with from web development: HTML, CSS, and JavaScript. If you've ever built a web page, you should feel right at home with extensions pretty quickly; we'll put that to the test right now by walking through the construction of a simple extension that will give you one-click access to pictures of kittens. Kittens! We'll do so by implementing a UI element we call a browser action, which allows us to place a clickable icon right next to Chrome's Omnibox for easy access. If you'd like to follow along at home (and you should!) The very first thing we'll need to create is a manifest file named manifest.json. In order to display kittens, we'll want to tell Chrome that we'd like to create a browser action, and that we'd like free-reign to access kittens from a particular source on the net.

Related: