笨办法学python学习笔记(1~5)

来源:互联网 发布:手机透视衣服软件 编辑:程序博客网 时间:2024/05/16 12:11

按照教程老老实实的敲了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> :
需要注意的是,#也表示的是单行注释,多行注释用三个单引号开头和结尾
'''

0 0
原创粉丝点击