Created
May 12, 2010 22:44
-
-
Save anarcher/399229 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#1. 딕셔너리 만들때 | |
key = (1,2,3,4,5) | |
value =('a','b','c','d','e') | |
b = zip(key,value) | |
print b | |
> { 1 : "a" , 2 : "b" } | |
print b[1] | |
> "a" | |
#2. 문자 포맷팅. | |
print "%s is %s" % ( "spam","beef") | |
> spam is beef | |
#3. 가변 인수 | |
def spam(x,*args): | |
print args | |
spam(1,"a","b",3) | |
> ("a","b",3) | |
#4. 패킹/언패킹 | |
x,y,z = "123" | |
> x = "1" | |
> y = "2" | |
> z = "3" | |
#5.apply 사용한 방법 | |
args = (1,2,3,4,5,6,) | |
apply(spam,args) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment