笨辦法學python學習筆記(1~5)


按照教程老老實實的敲了python的代碼

# -*- coding: utf-8 -*-
print "Hello World!"
print "Hello Again"
print "I like typing this"
print "This is fun."
print "Yay! Printing."
print "I'd much rather you 'you'."
print 'I "said" do not touch this.'
print "another line"


'''
Put a '#' (octothorpe) character at the beginning of a line. 
What did it do? Try to find out what this character does.
從官網上找到的答案如下:


Defining the Encoding
    Python will default to ASCII as standard encoding if no other
    encoding hints are given.


    To define a source code encoding, a magic comment must
    be placed into the source files either as first or second
    line in the file, such as:


          # coding=<encoding name>


    or (using formats recognized by popular editors)


          #!/usr/bin/python
          # -*- coding: <encoding name> -*-

    or
          #!/usr/bin/python
          # vim: set fileencoding=<encoding name> :
需要注意的是,#也表示的是單行注釋,多行注釋用三個單引號開頭和結尾
'''


注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
粤ICP备14056181号  © 2014-2020 ITdaan.com