점프 투 파이썬
: https://wikidocs.net/book/1
사이트를 참고하였음.
** 제곱연산자
: https://wikidocs.net/12#x-y
문자열 formatting
: https://wikidocs.net/13#format
>>> "I eat {0} apples".format(3) 'I eat 3 apples'
>>> number = 10 >>> day = "three" >>> "I ate {0} apples. so I was sick for {1} days.".format(number, day) 'I ate 10 apples. so I was sick for three days.'
Container
- list [,]
: https://wikidocs.net/14#_7
: append, pop/delete/remove
- dict {:}
: https://wikidocs.net/16#_6
: [], get, del
: keys, values
- tuple (,)
- set {,}
list slicing
: https://wikidocs.net/14#_4
>>> a = [1, 2, 3, 4, 5] >>> a[0:2] [1, 2]
if
: https://wikidocs.net/20#if_1
if 조건문: 수행할 문장1 수행할 문장2 ... else: 수행할 문장A 수행할 문장B ...
for
: https://wikidocs.net/22#for
for 변수 in 리스트(또는 튜플, 문자열): 수행할 문장1 수행할 문장2 ...
function
: https://wikidocs.net/24#_6
def 함수이름(매개변수): <수행할 문장> ... return 결과값
* ':' 다음 줄의 들여쓰기가 중요.
with
: https://wikidocs.net/26#with
f = open("foo.txt", 'w') f.write("Life is too short, you need python") f.close()
를 아래와 같이 handle scope내에서 파일 처리 가능
with open("foo.txt", "w") as f: f.write("Life is too short, you need python")
class method의 첫번째 매개변수
: https://wikidocs.net/28#_6

dir 내장 함수
: https://wikidocs.net/32#dir
댓글 없음:
댓글 쓰기