Python的基础(变量)
2014-11-03 15:00
155 查看
1.注释 # 开头
2.变量
Python中的变量不需要声明
变量使用前都需要复制,复制后变量才能够被创建
#变量
a = 100 #整型
b = 100.0 #浮点型
c = '大家好' #字符串
print(a)
print(b)
print(c)
这样复制也是正确的
#变量的赋值
a = b = c = 4
d, e, f = 5, 'c', "大家好"
print('a = ', a)
print('b = ', b)
print('c = ', c)
print('d = ', d)
print('e = ', e)
print('f = ', f)
#这里是注释 print("Hello World") #这里输出一句Hello World
2.变量
Python中的变量不需要声明
变量使用前都需要复制,复制后变量才能够被创建
#变量
a = 100 #整型
b = 100.0 #浮点型
c = '大家好' #字符串
print(a)
print(b)
print(c)
这样复制也是正确的
#变量的赋值
a = b = c = 4
d, e, f = 5, 'c', "大家好"
print('a = ', a)
print('b = ', b)
print('c = ', c)
print('d = ', d)
print('e = ', e)
print('f = ', f)
相关文章推荐
- Python基础:Python的变量和对象
- 变量及地址 分类: python基础学习 2013-06-15 15:32 190人阅读 评论(0) 收藏
- Python基础:Python的变量和对象
- python基础教程之基本数据类型和变量声明介绍
- python基础教程之基本数据类型和变量声明介绍
- python基础3--面向对象--类变量、实例变量、类方法、静态方法、实例方法
- Python 入门学习 -----变量及基础类型(元组,列表,字典,集合)
- Python学习笔记:02 基础:变量、整数、字符串、赋值、基本输出、注释、代码块
- Python基础(4) - 变量
- Python 第一章 基础知识(4) 变量和语句
- Python语法基础——关于全局变量与局部变量
- 【Python基础】之全局变量(UnboundLocalError: local variable referenced before assignment)
- global全局变量 分类: python基础学习 2013-06-30 09:54 181人阅读 评论(0) 收藏
- python基础教程之简单入门说明(变量和控制语言使用方法)
- python变量赋值(可变与不可变) 分类: python基础学习 python Module 2013-10-30 11:59 1036人阅读 评论(0) 收藏
- Python基础:Python的变量和对象
- Python学习入门基础教程(learning Python)--2.2 Python下的变量基础
- Python学习入门基础教程(learning Python)--2.2.1 Python下的变量解析 .
- Python基础:数据类型、变量定义、输入/输出、逻辑、函数/模块(导入)/类、异常处理
- Python基础:Python的变量和对象