Python 基础入门 2_1 variable

#变量,常量及数据类型
"""
数据类型分:Numbers(数字) String(字符串) List(列表) Tuple(元组) Dictionary(字典)等等

定义一个变量语法: 标识符 = 初始值
变量的数据类型取决于最后一次给该变量的数据类型
"""
# Num = 1 #定义Numbers数据类型变量Num
# Str = "Str" #定义String数据类型变量 Str
# list1 = [2 , '2'] #定义List数据类型变量 list
# tuple1 = (2 , 'two') #定义Tuple数据类型变量 tuple
# dict1 = {"key":"vlaue"} #定义Dictionary数据类型变量 dict
# bool = True #定义boolean数据类型变量True
# print(Num , Str , list1 , tuple1 , dict1 , bool)

#定义多变量 数据类型相同初始值相同,格式如下
# Num1 = Num2 = Num3 = 0
# print(Num1 , Num2 ,Num3)

#定义多变量 数据类型可以不同,初始值不同,格式如下:
# Str1 , Str2 , Str3 = "Str11","Str22","Str33"
# list2 , tuple2 , dict2 = [1,'one'] , (1 , 'One') ,{"key2":"value"}
# print(Str1 , Str2 ,Str3)
# print(list2 , tuple2 , dict2)

# 删除变量
# del list1
# print(list1)
原文地址:https://www.cnblogs.com/hjlin/p/10627311.html