Programming LearnByExample Python 2.3 Active programs
15 July 06:24
Type python at your carapace to blaze up the interpreter. >>> will be your prompt. If youre accounting in a statement, and its not complete, instead of >>> there will be ....
At the end of anniversary statement, the cipher is aggregate to bytecode and then executed.
If you just blazon a name of the variable, it will affectation the amount of the variable. If you say book variable, it will book the capricious (callin the __str__() function).
>>> banausic = asdf
adsf
>>> blah
asdf
adsf
>>> book blah
asdf
adsf
At any point, you can alarm dir(variable) on an item to see what methods you can alarm on it. You can aswell alarm help(data type, or Item name) to see affidavit on how to use methods.
>>> a = 34
>>> dir(a)
[__abs__, __add__, __and__, __class__, __cmp__, __coerce__, __delattr__, __div__, __divmod__, __doc__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __init__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __reduce__, __reduce_ex__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __setattr__, __str__, __sub__, __truediv__, __xor__]
>>> help(int)
All examples in this book are apparent as active interactively, so theyll all accept >>> at the alpha of anniversary statement.
Save your program in a file. Run python filename.py to run it. The analyst will first abridge it into bytecode, and then run it through the python interpreter.
Type python at your carapace to blaze up the interpreter. >>> will be your prompt. If youre accounting in a statement, and its not complete, instead of >>> there will be ....
At the end of anniversary statement, the cipher is aggregate to bytecode and then executed.
If you just blazon a name of the variable, it will affectation the amount of the variable. If you say book variable, it will book the capricious (callin the __str__() function).
>>> banausic = asdf
adsf
>>> blah
asdf
adsf
>>> book blah
asdf
adsf
At any point, you can alarm dir(variable) on an item to see what methods you can alarm on it. You can aswell alarm help(data type, or Item name) to see affidavit on how to use methods.
>>> a = 34
>>> dir(a)
[__abs__, __add__, __and__, __class__, __cmp__, __coerce__, __delattr__, __div__, __divmod__, __doc__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __init__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __reduce__, __reduce_ex__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __setattr__, __str__, __sub__, __truediv__, __xor__]
>>> help(int)
All examples in this book are apparent as active interactively, so theyll all accept >>> at the alpha of anniversary statement.
Save your program in a file. Run python filename.py to run it. The analyst will first abridge it into bytecode, and then run it through the python interpreter.
|
Tags: programming, statement, print variable, python, print, interpreter, running, statement, , programming learnbyexample python, |
Also see ...
PermalinkArticle In : Computers & Technology - Programming