내장함수 - input([prompt])
2015. 7. 20. 20:01ㆍIT관련
반응형
https://docs.python.org/2/library/functions.html#input
input([prompt])
eval(raw_input(prompt))과 동일하다.
>>> class fooboo():
... def __init__(self, data):
... self.data = data
...
>>> x = fooboo(123)
>>> xx = eval(raw_input("INPUT >> "))
INPUT >> x
>>> print xx
<__main__.fooboo instance at 0x10605da70>
>>> xx = input("INPUT >>")
INPUT >>x
>>> xx = raw_input("INPUT >>")
INPUT >>x
>>> print xx
x
>>> print xx
<__main__.fooboo instance at 0x10605da70>
>>> xx = input("INPUT >>")
INPUT >>iu
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1, in <module>
NameError: name 'iu' is not defined
반응형
'IT관련' 카테고리의 다른 글
내장함수 - isinstance(object, classinfo) (0) | 2015.07.22 |
---|---|
내장함수 - int (0) | 2015.07.22 |
내장함수 - id(obejct) (0) | 2015.07.20 |
내장함수 - hex(x) (0) | 2015.07.20 |
내장함수 - help(object) (0) | 2015.07.20 |