Skip to content

Instantly share code, notes, and snippets.

@ichiren1
ichiren1 / gist:b82a44525b2247f69b7cf9a4859df76a
Last active February 14, 2017 06:58
python内包記法個人的まとめ

1次配列

a = []
for i in range(10):
  a.append(i)

内包

a = [i for i in range(i)]
@ichiren1
ichiren1 / python_re_in_lc.py
Last active August 29, 2015 14:25 — forked from dogrunjp/python_re_in_lc.py
Pythonはリスト内包表記の中で正規表現が使えるとのこと。テキスト処理に使えそう。
>>>import re
>>>list = ['a', '1', 'bc', '-b', '2a','100']
>>>r = re.compile("[a-z]")
>>>[x for x in list if r.mathch(x)]
['a','bc']
#include<stdio.h>
int main(){
printf("Hello git!\n");
}