This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cuisine | |
| from fabric.api import roles, sudo | |
| apt_updated = None | |
| def apt_update(force=False): | |
| global apt_updated | |
| if force or not apt_updated: | |
| state = sudo('apt-get update -q') | |
| apt_updated = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # encoding: utf8 | |
| # Kanban of Python Taiwan in Early November | |
| # Python Quest #2 | |
| dates = ['1 year, 10 months, 15 days', | |
| '2 years, 1 month, 15 days', | |
| '1 month, 15 days', | |
| '1 year', | |
| '2 months', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import sql | |
| from sqlalchemy import MetaData, Table, Column, String, DateTime | |
| metadata = MetaData() | |
| users = Table('users', metadata, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "metadata": { | |
| "name": "play3" | |
| }, | |
| "nbformat": 3, | |
| "nbformat_minor": 0, | |
| "worksheets": [ | |
| { | |
| "cells": [ | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask, render_template | |
| from flask.ext.wtf import Form, widgets, SelectMultipleField | |
| SECRET_KEY = 'development' | |
| app = Flask(__name__) | |
| app.config.from_object(__name__) | |
| class MultiCheckboxField(SelectMultipleField): | |
| widget = widgets.ListWidget(prefix_label=False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| C3DCBLJSMR | |
| CB88YXR373 | |
| 3PYCX4RH5A | |
| D5AKEFEYCD | |
| 3AN6FMALSF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| % python taipeipy_scores.py | |
| {2: 9, 3: 4, 4: 6, 5: 8, 6: 3} | |
| [2, 5, 4, 3, 6] | |
| """ | |
| import pprint | |
| vote_lists = ([5, 2, 4, 6, 3], | |
| [4, 5, 2, 3, 6], | |
| [2, 3, 6, 5, 4]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -for row in ['apple', 'banana', 'pineapple']: tr | |
| -for col in ['juice', 'muffin', 'pie']: td | |
| ${row.capitalize()} ${col} | |
| -<tr> for row in ['apple', 'banana', 'pineapple'] | |
| -<td> for col in ['juice', 'muffin', 'pie'] | |
| ${row.capitalize()} ${col} | |
| tr -for row in ['apple', 'banana', 'pineapple'] | |
| td -for col in ['juice', 'muffin', 'pie'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
| "http://www.w3.org/TR/html4/loose.dtd"> | |
| <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | |
| <title>Vim reStructured Text</title> | |
| <meta name="Generator" content="Vim reStructured Text 140 - Vim 7.3" /> | |
| <meta name="Author" content="Mikolaj Machowski" /> | |
| <meta name="Title" content="Vim reStructured Text - HTML and LaTeX output" /> | |
| <meta name="Keywords" content="Vim, LaTeX, PDF, HTML, XML" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def part_list(l, head_amount=1, tail_amount=1): | |
| length = len(l) | |
| tail_start = length - tail_amount | |
| return l[head_amount-1], l[head_amount:tail_start], l[tail_start] | |
| def main(): | |
| l = range(5) | |
| x, y, z = part_list(l, 1, 1) | |
| print(x) # 0 |