python 元组切片
2024-10-13 23:39:14
#create a tuple
tuplex = (, , , , , , , , , )
#used tuple[start:stop] the start index is inclusive and the stop index
_slice = tuplex[:]
#is exclusive
print(_slice)
#if the start index isn't defined, is taken from the beg inning of the tuple
_slice = tuplex[:]
print(_slice)
#if the end index isn't defined, is taken until the end of the tuple
_slice = tuplex[:]
print(_slice)
#if neither is defined, returns the full tuple
_slice = tuplex[:]
print(_slice)
#The indexes can be defined with negative values
_slice = tuplex[-:-]
print(_slice)
#create another tuple
tuplex = tuple("HELLO WORLD")
print(tuplex)
#step specify an increment between the elements to cut of the tuple
#tuple[start:stop:step]
_slice = tuplex[::]
print(_slice)
#returns a tuple with a jump every items
_slice = tuplex[::]
print(_slice)
#when step is negative the jump is made back
_slice = tuplex[::-]
print(_slice)
最新文章
- POJ1704 Georgia and Bob
- React + Redux 入坑指南
- TortoiseSVN文件夹及文件图标不显示解决方法
- 努力学习 HTML5 (4)—— 浏览器对语义元素的支持情况
- sql 表连接 join
- cvc-elt.1: 找不到元素 'beans' 的声明
- js中关于arguments
- STM32 使用 printf 发送数据配置方法 -- 串口 UART, JTAG SWO, JLINK RTT
- error while loading shared libraries: libgtk-x11-2.0.so.0 2014-05-12 22:49:34
- load dll
- dbutils的使用Demo
- python-认识Socket[入门篇]
- hdu--1072--Nightmare(bfs回溯)
- Java中RuntimeException和Exception的区别
- python导出zabbix数据并发邮件脚本
- 性能测试工具 wrk 使用教程
- JMeter学习笔记01-安装环境
- MySQL 中的数字类型
- RxSwift之路 2#如何开始
- 关于Handler中Message的创建问题
热门文章
- [LeetCode] 101. Symmetric Tree_ Easy tag: BFS
- 使用masory
- Winsock网络编程
- VMware Coding Challenge: Possible Scores &;&; Summary: static
- 兼容安卓和ios实现一键复制内容到剪切板
- nginx的权限问题(Permission denied)解决办法
- python3.4学习笔记(二十四) Python pycharm window安装redis MySQL-python相关方法
- mysql修改Truncated incorrect DOUBLE value:
- MySQL性能分析和优化
- [转] Python的import初探