2015년 4월 2일 목요일

Starting Python.

I worked as S/W Engineer with C/C++ over 10 years.
But I didn't have my script language.
So, I Decided to lean Python for Simple scripting.

Installed Python 3.4.3 to my desktop ( It's Windows 7 ) and  Free AWS server ( Ubuntu )  .

And run python.
typed
>>> print "A"

but error.

>>> print "A"
  File "<stdin>", line 1
    print "A"
            ^
SyntaxError: Missing parentheses in call to 'print'
>>>

typed print("A")

it works.

 print ( "A" ) works too.


python support automatic variables, so I don't have to declare variable before use it like another scripts language.

just type  A=10, print(A)
...

Error!

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'A' is not defined

first time, I think Why it doesn't work?

wait a sec...

typed A
10, None

it was changed to list!!!

python read it like this  A=(10, print(A))


댓글 없음:

댓글 쓰기