• day3 前奏


    1.第1个c语言

    编辑---编译----运行
    python@ubuntu:~/Desktop/pythons06$ vim 01-第1个c语言.c
    #include<stdio.h>
    int  main(int argc,char ** argv)
    {
        printf("hello world
    ");
        return 0;
    }
    
    python@ubuntu:~/Desktop/pythons06$ gcc 01-第1个c语言.c 
    python@ubuntu:~/Desktop/pythons06$ ls -a
    .   01-第1个c语言.c  1-softlink.txt  2.txt  5.py   command
    ..  1-hardlink.txt   1.txt           4.py   a.out  test.sh
    
    
    python@ubuntu:~/Desktop/pythons06$ ./a.out 
    hello world

    2.第1个Python程序

    编辑编译---》直接运行
    python@ubuntu:~/pythons06$ vim 02-第1个Python.py 
    print("hello world")
    
    python@ubuntu:~/pythons06$ python 02-第1个Python.py 
    hello world

        

    3.python2 和Python3,IPython

      推荐:ipython3

    python@ubuntu:~/pythons06$ python3
    Python 3.5.2 (default, Jul  5 2016, 12:43:10) 
    [GCC 5.4.0 20160609] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 
    >>> exit()
    python@ubuntu:~/pythons06$
    
     
    python@ubuntu:~/pythons06$ python3 02-第1个Python.py 
    hello world
    python@ubuntu:~/pythons06$ 
    #ipython
    python@ubuntu:~/pythons06$ ipython
    Python 2.7.12 (default, Jul  1 2016, 15:12:24) 
    Type "copyright", "credits" or "license" for more information.
    
    IPython 2.4.1 -- An enhanced Interactive Python.
    ?         -> Introduction and overview of IPython's features.
    %quickref -> Quick reference.
    help      -> Python's own help system.
    object?   -> Details about 'object', use 'object??' for extra details.
    
    In [1]: exit
    
    
    #ipython3
    python@ubuntu:~/pythons06$ ipython3
    Python 3.5.2 (default, Jul  5 2016, 12:43:10) 
    Type "copyright", "credits" or "license" for more information.
    
    IPython 2.4.1 -- An enhanced Interactive Python.
    ?         -> Introduction and overview of IPython's features.
    %quickref -> Quick reference.
    help      -> Python's own help system.
    object?   -> Details about 'object', use 'object??' for extra details.
    
    In [1]: 

    4.注释

      注释的作用

    • 通过用自己熟悉的语言,在程序中对某些代码进行标注说明,这就是注释的作用,能够大大增强程序的可读性
    • 100行代码 50行注释

       python2 识别中文

     #-*- coding:utf-8 -*-            在python的语法规范中推荐使用的方式:
     #coding=utf-8
  • 相关阅读:
    CSS预编译:less入门
    JavaScript学习(五):函数表达式
    关于JavaScript new 的一些疑问
    JavaScript学习(四):面对对象的程序设计
    JavaScript学习(三):引用类型
    JavaScript学习(二):变量、作用域和内存问题
    JavaScript学习(一):基本概念
    匿名函数的this指向为什么是window?
    阿里云ECS在CentOS 6.8中使用Nginx提示:nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)的解决方法
    Centos释放缓存
  • 原文地址:https://www.cnblogs.com/venicid/p/7822756.html
Copyright © 2020-2023  润新知