Advertisement

(第2节) Python基础语法

阅读量:

目录

Python 保留字

del

注释

缩进

标准数据类型

类型判断

字符串

输入&等待用户输入

同一行显示多条语句

多个语句构成代码组

print输出

import和from ... import

Python3中_和__的用途和区别

一、_(下划线)

1、临时变量

2、未使用的变量

二、__(双下划线)

1、私有属性:

2、私有方法:

三、__的一些特殊用途。



Python保留字解析

复制代码
 import keyword

    
 print(keyword.kwlist)
    
  
    
 运行 "Import-Module PSReadLine"。
    
  
    
 PS F:\学习\python\测试> & C:/Users/Python/Python311/python.exe f:/学习/python/测试/test.py
    
 ['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from',

全部评论 (0)

还没有任何评论哟~