last time i run a python in shell . so are there any other techonicals to do . the key is yes , for sure . remmenber the editor i referfed to . they are ok .
i will use it as a new way to run a python script that also shows the hello world .
chrysanthemumwolf@chrysanthemumwolf-laptop:~$ vim helloworld.py
chrysanthemumwolf@chrysanthemumwolf-laptop:~$ cat helloworld.py
#!usr/bin/python
#filename :helloworld.py
print 'hello world'
chrysanthemumwolf@chrysanthemumwolf-laptop:~$ python helloworld.py
hello world
chrysanthemumwolf@chrysanthemumwolf-laptop:~$
note: the notation in the first line of the small script is telling the linux(your os) that this is programm should be run with this interpreter when you x it . and other # is just the comment like in c/c++.
following it is the constant i learn .
python has four number type : integer, long integer, floating point , and complex number. and this is kinda different from c/c++.
and it doesn`t have a char but a string type to hold a constant .
we can use string like that
print 'i am wolf'
or print "i am wolf"
or print ''' i am wolf '''
these are the results:
>>> print 'i am wolf'
i am wolf
>>> print "i am wolf"
i am wolf
>>> print '''i am wolf'''
i am wolf
>>> whereas what`s the differece betweeen (among)the single quotes , double quotes ,and triple quotes.
i will give some instance to explore it .
>>> print 'what's your name'
File "<stdin>", line 1
print 'what's your name'
^
SyntaxError: invalid syntax
>>> print 'what/'s your name'
what's your name
>>> print ''
>>> print "what's your name"
what's your name
>>> print '''what's your name'''
what's your name
i want to explain it simple not complicated like the books written by the c++ giant.
the fuction of them are the same . what makes them different is that we cannot use the same notations in the string . ihe interpretor will be get confused by that .and it cannot match them one by one . so the use of "" & ''' ''' is the same.
one of the necessary part is if you write a long command or statement ,and do not want to seperate it into two lines ,what wolud you gonna do . we should still use the escape sequence / that`s ok.
good luck .