Skip to content

Instantly share code, notes, and snippets.

View KuKuXia's full-sized avatar
🎯
Focusing

KuKuXia KuKuXia

🎯
Focusing
View GitHub Profile
@KuKuXia
KuKuXia / Revert-Gist.md
Created June 3, 2019 01:13 — forked from eduncan911/Revert-Gist.md
Revert Gist Commits

Revert / Undo a Gist Commit

It was not exactly obvious. Here's how to revert a Gist commit!

Checkout the gist like a normal git repo:

# replace the Gist ID with your own
git clone git@github.com:cc13e0fcf2c348cc126f918e4a3917eb.git

Treat it like a normal repo. Edit, force push, etc.

@KuKuXia
KuKuXia / iterator_chunk_size.py
Created December 28, 2019 15:41
利用迭代器实现数据的块输入
"""
利用迭代器实现数据的块输入
"""
CHUNK_SIZE = 50
with open('somefile.txt') as f:
for chunk in iter(lambda: f.read(CHUNK_SIZE), ''):
print(chunk)
print('-' * 20)