Skip to content

Instantly share code, notes, and snippets.

import asyncio
loop = asyncio.get_event_loop()
async def hello(task, sleep_seconds):
print('{}:hello'.format(task))
await asyncio.sleep(sleep_seconds)
print('{}:world!'.format(task))
@8dspaces
8dspaces / py.py
Created July 24, 2018 06:48
python interview questions
# encoding: utf8
# 什么是lambda函数?它有什么好处?另外python在函数式编程方面提供了些什么函数和语法?
# - lambda 就是匿名函数
# - 好处: 可以动态生成一个函数对象,不用给这个对象命名,污染名字空间
# - 函数:map()/filter()
# - 语法:可以函数内部定义函数,闭包支持
# 详细说说tuple、list、dict的用法,它们的特点;
# - tuple 固定长度的子项不可变的顺序型容器,一般用来做常量(策划配表)或者表示少量属性的对象(比如pos)表示
@8dspaces
8dspaces / plink-plonk.js
Created April 10, 2020 13:40 — forked from tomhicks/plink-plonk.js
Listen to your web pages