码迷,mamicode.com
首页 >  
搜索关键字:tuple    ( 3184个结果
Python set list dict tuple 区别和相互转换 - Python零基础入门教程
目录 一.前言 二.Python set list dict tuple 区别 三.猜你喜欢 零基础 Python 学习路线推荐 : Python 学习目录 >> Python 基础入门 一.前言 Python 提供多种数据类型来存放数据项集合,主要包括序列(列表 list 和元组 tuple),映 ...
分类:编程语言   时间:2021-06-19 19:15:33    阅读次数:0
python基础:数据类型,list,tuple,dict,set
写在前边: list和tuple都是有序的,取值方式如list[1],tuple[1]。 list列表,是一种可变序列 tuple元组,是一种不可变序列,初始化后就不能修改 dict和set都是无序的。 dict字典,等同于map。dict存储键值对,如dict1 = {"key":"value"} ...
分类:编程语言   时间:2021-06-15 18:53:57    阅读次数:0
实验六 Python库应用编程与体验
import turtle turtle.setup(800,600) turtle.pencolor('pink') for i in range(4): for i in range(2): turtle.circle(80,90) turtle.left(90) turtle.right(90 ...
分类:编程语言   时间:2021-06-13 09:20:06    阅读次数:0
Python 不可变数据类型
1 可变数据类型:字典dict、列表list、集合set 2 不可变数据类型:字符串string、元组tuple 3 数字:整数int、小数float、布尔bool 3.1 随机数 3.1.1 默认输出0到1之间的数: 1 import random 2 print(random.random()) ...
分类:编程语言   时间:2021-06-11 18:21:34    阅读次数:0
Python:获取某一月的天数
import calendar >>> calendar.monthrange(2010,10)[1] 31 >>> calendar.monthrange(2020,3) (6, 31) calendar.monthrange( year , month ) 返回一个tuple,第一个元素是这个月 ...
分类:编程语言   时间:2021-06-08 23:21:11    阅读次数:0
c++ 可变参数的打包到tuple,使用tuple传递参数
直接上代码 void Add(int a, double b, short c, const char * f) { std::cout << f << a << ", " << b << ", " << c << ";\n"; } void *p = nullptr; template <type ...
分类:编程语言   时间:2021-06-04 19:35:50    阅读次数:0
12道Python字符编码和数据类型练习题
1、转换 将字符串s = "alex"转换成列表 s = "alex" s_list = list(s) print(s_list) 将字符串s = "alex"转换成元祖 s = "alex" s_tuple = tuple(s) print(s_tuple) 将列表li = ["alex", " ...
分类:编程语言   时间:2021-06-02 12:05:16    阅读次数:0
Python collections
collections collections是Python内建的一个集合模块,提供了许多有用的集合类。 nametuple是一个函数,它用来创建一个自定义的tuple对象,并且规定了tuple元素的个数,并可以用属性而不是索引来引用tuple的某个元素。这样一来,我们用namedtuple可以很方 ...
分类:编程语言   时间:2021-05-24 14:16:35    阅读次数:0
python内置函数
# print()# input()# len()# type()# int()# str()# list()# tuple()# dict()# set()# float()# id() # avg = sum(l) / len(l) #计算平均值# print(avg)# print( max( ...
分类:编程语言   时间:2021-05-24 13:23:00    阅读次数:0
python time模块练习
import time#时间戳,从计算机诞生那一天到现在过了多少秒 1621063294#格式化好的时间 2021-5-15 19:38:23#2021515 ->50天后print( int(time.time()) ) #获取当前的时间戳print( time.strftime('%Y-%m-% ...
分类:编程语言   时间:2021-05-24 13:22:39    阅读次数:0
3184条   1 2 3 4 ... 319 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!