본문 바로가기

전체 글

Python - inline if 문 "true일때 값" if "조건식" else "false 일때 값" 예제 print ("aa" if True else "bb") #aa print ("aa" if False else "bb") #bb 더보기
Python 어렵게 배우기 - Exercise 39: Dictionaries, Oh Lovely Dictionaries 원문 : http://learnpythonthehardway.org/book/ex39.html python 에는 Dictionary라는 놈이 있다. 간단히 이야기하면 Key : Value 형태로 데이터를 입력하는 Map 같은 놈이다. 사용 양식은 stuff = {'name': 'Zed', 'age': 36, 'height': 6*12+2} 뭐 이런식으로 사용 할 수 있다. 예제 코드를 통해 좀더 알아보자 (ex39.py) # create a mapping of state to abbreviation states = { 'Oregon': 'OR', 'Florida': 'FL', 'California': 'CA', 'New York': 'NY', 'Michigan': 'MI' } # create a basi.. 더보기
Riot.js — The 1kb client-side MVP(Model View Presenter) library https://moot.it/blog/technology/riotjs-the-1kb-mvp-framework.html 더보기
Python - 현재 년, 월, 일, 시, 분, 초 문자열로 표현하기 (yyyymmddhh24miss 형태) datetime.now() 함수와 format 함수를 사용하면 된다. datetime.now()는 현재 시간을 datetime 형태로 반환한다. format 과 관련해서는 http://docs.python.org/2/library/string.html#formatstrings 페이지를 참조하자. from datetime import datetime print "{:%Y%m%d%H%M%S}".format(datetime.now()) 더보기
Python - 문자를 ASCII 코드로, ASCII 코드를 문자로 ord(문자) : 문자의 ASCII 코드를 반환한다.chr(숫자) : 숫자에 대응하는 문자를 반환한다. ord("A") #결과값 65 chr(65) #결과값 A #참고로 #A 는 chr(65) #Z 는 chr(90) #a 는 chr(97) #z 는 chr(122) 더보기
알아둬야할 JavaScript 프로젝트들 (링크) http://www.buggymind.com/533 더보기
Python 어렵게 배우기 - Exercise 38: Doing Things To Lists 원문 : http://learnpythonthehardway.org/book/ex38.html List를 좀더 사용해 보자 (ex38.py) ten_things = "Apples Oranges Crows Telephone Light Sugar" print "Wait there's not 10 things in that list, let's fix that." stuff = ten_things.split(' ') more_stuff = ["Day", "Night", "Song", "Frisbee", "Corn", "Banana", "Girl", "Boy"] while len(stuff) != 10: next_one = more_stuff.pop() print "Adding: ", next_one stuff.. 더보기
Python 어렵게 배우기 - Exercise 37: Symbol Review 원문 : http://learnpythonthehardway.org/book/ex37.html python에서 사용하는 symbol에 대해서 살펴보자 (알아서들...) 더보기