代码改变世界

008: function的定义及调用

2016-01-06 23:37 by Miles.Yao, 266 阅读, 0 推荐, 收藏, 编辑
摘要:1. 函数由关键字def来做定义2. 函数内部如果没有返回值,默认返回None3. 函数接受default参数,The default value is evaluated only once.This makes a difference when the default is a mutable... 阅读全文

007: 基本控制语句 for , while, 和 range 数据类型

2016-01-05 16:20 by Miles.Yao, 335 阅读, 1 推荐, 收藏, 编辑
摘要:Python中的for语句与其它语言for语句略有不同,它是迭代一个序列。Theforstatement in Python differs a bit from what you may be used to in C or Pascal. Rather than always iterating... 阅读全文

006: 基本控制语句 if 与 bool 数据类型

2016-01-04 16:53 by Miles.Yao, 608 阅读, 0 推荐, 收藏, 编辑
摘要:1. bool类型与其他数据类型之间存在一个隐式的转换关系,与javascript极其相似:Any object can be tested for truth value, for use in aniforwhilecondition or as operand of the Boolean o... 阅读全文

005: 基本数据类型-Tuple

2016-01-04 15:27 by Miles.Yao, 281 阅读, 0 推荐, 收藏, 编辑
摘要:Tuple 可以理解为数组,初始化之后数组本身便不可更改。它是一种表示序列化数据的数据类型,目前只做初步学习,以后再做更深入的了解。 Tuples may be constructed in a number of ways: 1)Using a pair of parentheses to den 阅读全文

004: 基本数据类型-List

2015-12-30 16:35 by Miles.Yao, 219 阅读, 0 推荐, 收藏, 编辑
摘要:List 也就是数组,但是这个数组是动态的,用中括号与逗号创建。 Python knows a number of compound data types, used to group together other values. The most versatile is the list, wh 阅读全文

003: 基本类型-字符串类型

2015-12-29 21:37 by Miles.Yao, 274 阅读, 0 推荐, 收藏, 编辑
摘要:1)They can be enclosed in single quotes ('...') or double quotes ("...") with the same result. \ can be used to escape quotes 2)If you don’t want char 阅读全文

002: 基本类型-数值型(int, float)

2015-12-29 19:18 by Miles.Yao, 419 阅读, 0 推荐, 收藏, 编辑
摘要:基本类型中数值类型有 int, float, Decimal, Fraction其中int 和 float 是比较常见的类型, 而Decimal 和 Fraction 不是那么常见, 所以暂时学习int 和 float.Division (/) always returns a floatTo do... 阅读全文

001: Hello World

2015-12-29 18:27 by Miles.Yao, 167 阅读, 0 推荐, 收藏, 编辑
摘要:今天下决心从零开始学习Python, 为了以后方便复习,所以记录学习的过程。操作系统环境:Windows 7Python 版本:3.4开发工具: Sublime Text 3; Cmder看了下Python的简单介绍,个人感觉它是一种把Javascript中比较好的特性融合到一般高级编程语言中而形成... 阅读全文