반응형

Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32

Type "copyright", "credits" or "license()" for more information.


    ****************************************************************

    Personal firewall software may warn about the connection IDLE

    makes to its subprocess using this computer's internal loopback

    interface.  This connection is not visible on any external

    interface and no data is sent to or received from the Internet.

    ****************************************************************

    

IDLE 2.6.5      

>>> pinr


Traceback (most recent call last):

  File "<pyshell#0>", line 1, in <module>

    pinr

NameError: name 'pinr' is not defined

>>> 

>>> print "I eat %s apples."%"five"

I eat five apples.

>>> number=3

>>> print"I eat %d apples."%nuber


Traceback (most recent call last):

  File "<pyshell#4>", line 1, in <module>

    print"I eat %d apples."%nuber

NameError: name 'nuber' is not defined

>>> print "I eat %d apples." % number

I eat 3 apples.

>>> a="hi"

>>> a.upper()

'HI'

>>> a="hobby"

>>> a.count('b')

2

>>> NameError: name 'nuber' is not defined

SyntaxError: invalid syntax

>>> a='Python is best choice"

SyntaxError: EOL while scanning string literal

>>> a.find('b')

2

>>> a="life is too short"

>>> a.index('t')

8

>>> a=","

>>> a.join('abcd')

'a,b,c,d'

>>> a="Hi man"

>>> a.swapcase()

'hI MAN'

>>> odd=[1,3,5,7,9]

>>> dic={'name':'pey','phone':'0119993323','birth':'1118'}

>>> grade={'pey':10,'juliet':99}

>>> grade['pey']

10

>>> grade['juliet']

99

>>> a=[1,2,3,4]

>>> while a:

a.pop()


4

3

2

1

>>> if[]:

print "True"

else:

SyntaxError: invalid syntax

>>> if []:

print "True"

else:

SyntaxError: invalid syntax

>>> if[1,2,3]:

print "True"

else:

print "False"


True


+)쭉한번 훑은다음에 프로그램하나 만들 계획

반응형

'과거의 컴퓨터 공부 > Python' 카테고리의 다른 글

lambda(),struct.pack, struct.unpack  (0) 2014.09.05
sys모듈 사용  (0) 2014.08.29
자판기.py  (0) 2014.08.28
기본적인 연산, for 문, if 문  (0) 2014.08.25
,