美文网首页
笨办法学Python ex01

笨办法学Python ex01

作者: Joemini | 来源:发表于2016-12-10 12:09 被阅读0次

    第一个程序


    • 输入:
    print "Hello Again"
    print "I like typing this." 
    print "This is fun."
    print "Yay! Printing."
    print "I'd much rather you 'not'."
    print "I'd much rather you 'not'."
    print 'I "said" do not touch this.'
    
    • 运行:

      <div aligh= "left" >

    遇到的问题:

    运行过程中,在cmd换目录:
    换盘> d: 回车换
    目录> cd mybook 回车


    附加题


    • 1、让你的脚本多打印一行
    print "Hello World!"
    print "Hello Again"
    print "I like typing this." 
    print "This is fun."
    print "Yay! Printing."
    print "I'd much rather you 'not'."
    print "I'd much rather you 'not'."
    print 'I "said" do not touch this.'
    print u"我来自中国!"
    

    遇到的问题:

    使用python自带的文本编辑器,设置好了utf-8,且头行标注了格式,在cmd运行文件的时候还是出现中文的乱码。
    百度这个问题,有个回答:print u"我来自中国!",前面加了u,这样就能正常显示了

    • 2、让你的脚本只打印一行
      只需要在代码前加注释符号“#”即可
    • 3、在某行的起始位置放一个#(#)符号。它的作用是什么?
      能够将该行代码转为注释,运行的时候会跳过注释

    相关文章

      网友评论

          本文标题:笨办法学Python ex01

          本文链接:https://www.haomeiwen.com/subject/puoymttx.html