摘要: 字符串类型 1、作用2、定义 msg='hello' # msg=str('msg') print(type(msg)) <class 'str'> 3、类型转换str可以把任意其他类型都转成字符串 res=str({'a':1}) print(res,type(res)) {'a': 1} <cl 阅读全文
posted @ 2020-03-10 18:10 学海无涯苦中作乐 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 数字类型 一:int类型1、作用:2、定义:age = 10 # age=int(10) 名字(参数) print('hello','world') hello world x=int(10)name=input('xxx')res=print('xxx') # 没有产品print(res) 2、类 阅读全文
posted @ 2020-03-10 16:19 学海无涯苦中作乐 阅读(227) 评论(0) 推荐(0) 编辑
摘要: for循环-前言''' 1、什么是for循环 循环就是重复做某件事,for循环是python提供第二种循环机制 2、为何要有for循环 理论上for循环能做的事情,while循环都可以做 之所以要有for循环,是因为for循环在循环取值(遍历取值)比while循环更简洁 3、如何用for循环 语法: 阅读全文
posted @ 2020-03-10 16:01 学海无涯苦中作乐 阅读(245) 评论(0) 推荐(0) 编辑