python核心编程(第一周)

python核心编程[第二版]

[宋吉广译]

[人民邮电出版社]

第一章 欢迎来到python世界

  • 什么是python
  • python的起源
  • python的特点
  • 下载python
  • 安装python
  • 运行python
  • python文档
  • 比较python(与其他语言的比较)
  • 其他实现

第二章 python起步

  • 介绍
  • 输入/输出
  • 注释
  • 操作符
  • 变量与赋值
  • python类型
  • 缩进
  • 循环与条件
  • 文件
  • 错误
  • 函数
  • 模块

第三章 python基础

  • 语句与语法
  • 变量赋值
  • 标识符与关键字
  • 基本风格指南
  • 内存管理
  • 第一个python程序
  •  1 'write.py -- create text file'
     2 # 输入文件名 创建文件 按行写内容 最后存到文件中
     3 import os  # 导入模块
     4 Is = os.linesep
     5 
     6 # get filename
     7 while True:
     8     fname = input("give a file name : ")
     9     if os.path.exists(fname):
    10         print("ERROR:'%s'already exists " % fname)
    11     else:
    12         break
    13 
    14 # get file content (text) lines
    15 all = []
    16 print("
    Enter lines ( .by itself to quit).
    ")
    17 
    18 # loop until user terminates input
    19 while True:
    20     entry = input('>>>  ')
    21     if entry == '.':
    22         break
    23     else:
    24         all.append(entry)
    25 
    26 #write lines to file with proper line-ending
    27 fobj = open(fname,'w')
    28 fobj.writelines(['%s%s' % (x,Is) for x in all])
    29 fobj.close()
    30 print("DONE!")
    # 输入文件名 打开文件 按行读取数据
    'read.py -- read file'
    
    # get file name
    fname = input("Enter filename : ")
    print()
    
    #attempt to open file for reading
    try:
        fobj = open (fname,'r')
    except IOError :
        print("*** flie open error:")
    else:
        for eachLine in fobj:
            print(eachLine)
        fobj.close()


第四章 python对象

  • python对象
  • 内建类型
  • 标准类型运算符
  • 值的比较
  • 对象身份比较
  • 布尔类型
  • 标准类型内建函数
  • 标准类型总览
  • 各种类型
  • 不支持的类型

v、

原文地址:https://www.cnblogs.com/tenjl-exv/p/8039366.html