![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
文章平均质量分 56
小小的阿遥
这个作者很懒,什么都没留下…
展开
-
Python基础知识(四)
Python函数 01、创建函数 # 创建函数语法 def funaction_name(parameters): """docstring""" statements(s) 02、调用函数 name = "Tom" #定义函数 def greet(name): """This function greets to the person passed in as parameter""" print("Hello," + name + ",Good morning!")原创 2021-06-26 21:59:58 · 132 阅读 · 0 评论 -
Python基础知识(三)
For循环 01、For循环 For循环是迭代对象元素的常用方法 。 代码块:使用缩进,块内的行必须通过制表符缩进,或相对于周围的命令缩进4个空格。 # 迭代列表 for number in [23, 41, 12, 16, 7]: print(number) ''' 23 41 12 16 7 ''' 02、枚举 返回一个元组,其中包含每次迭代的计数(从默认为0开始)和迭代序列获得的值 # 迭代列表 lists = ['steve', 'rachel', 'michael',原创 2021-06-23 22:46:07 · 75 阅读 · 0 评论 -
Python基础知识(二)
一、字典 字典是一种将键(key)映射到值(value)的无序数据结构 。 字典的值可以是任何值,如列表,函数,字符串等;键(key)必须是不可变的,例如,数字,字符串或元组等。 对字典的操作,即对字典的键进行操作。 # 定义一个字典 dict = {'start':'There is a new start','second':'This a dictionary','third':'Let\'s go'} print(dict) # {'start': 'There is a new start',原创 2021-06-23 14:24:00 · 77 阅读 · 0 评论 -
Python基础知识(一)
一、基础类型 01、入门的第一步 print('Hello World!') # Hello World! 02、字符串的输出 # 字符串可以被三种符号包围-',",""" print('Hello World!') # Hello World! print("Hello World!") # Hello World! print("""Hello World!""") # Hello World! 03、\t(制表符,即Tab)、\n(换行) # \t print("Hello \t Wo原创 2021-06-22 19:32:07 · 51 阅读 · 0 评论