zoukankan      html  css  js  c++  java
  • 【Python初学者】准备

    准备着手学习Python这门久仰大名的语言。本篇随笔是学习它的准备阶段。

    操作系统:

    Mac OS 10.11.5

    下载编辑器Testwrangler

    点我

    第一个Python程序

    在命令行中运行python:

    在命令行中新建文件夹ChenPython,并且在其中新建文件 MyFirstPythonProgram

    换名字,改成.py格式;然后编辑它,在终端运行:python MyFirstPythonProgram.py

    井号的作用

    在python中,#是注释的意思。

    #Python examples 2016/9/19 by wasdns
    print "HelloWorld!"
    #End of file
    

    #的英文名是pound character。

    简单计算

    #Python Examples 2016/9/19 by Wasdns
    print "Calculator:" 30 + 25 / 5
    print "Calculator:" 30 % 5
    #End of file
    

    哈哈,首错:

    更改:

    #Python Examples 2016/9/19 by Wasdns
    print "Calculator:", 30 + 25 / 5
    print "Calculator:", 30 % 5
    #End of file
    

    输出结果:

    增加大小比较:

    #Python Examples 2016/9/19 by Wasdns
    print "Calculator:", 30 + 25 / 5
    print "Calculator:", 30 % 5
    
    print "Pause..."
    
    print "It's it true? 3 + 3 < 9", 3 + 3 < 9
    print "Did the Terminal print true?"
    #End of file
    

    输出:

    变量

    #Python Examples 2016/9/19 by Wasdns
    print "Calculator:", 30 + 25 / 5
    print "Calculator:", 30 % 5
    
    print "Pause..."
    
    print "It's it true? 3 + 3 < 9", 3 + 3 < 9
    print "Did the Terminal print true?"
    
    print "Add a variable..."
    
    Iamboy = 1
    Sheisgirl = 1
    Iamgirl = 0
    Sheisboy = 0
    
    print "Iamboy = ", Iamboy, " Sheisgirl = ", Sheisgirl, " Iamgirl = ", Iamgirl, " Sheisboy = ", Sheisboy
    
    print "Add Finished..."
    
    #End of file
    

    输出:

    2016/9/19

  • 相关阅读:
    VMware15 安装centos7标准板
    jQuery拼接HTML标签元素
    解决win10 蓝牙设备只能配对无法连接 ,并且删除设备无效的问题
    Linux:系统的基本优化
    nano编辑器的设置
    Linux:网络yum源设置
    MySQL:MySQL的基本操作
    MySQL:MySQL的安装
    Python之路:堡垒机实例以及数据库操作
    paramiko 模块安装
  • 原文地址:https://www.cnblogs.com/qq952693358/p/5886295.html
Copyright © 2011-2022 走看看