当前位置:网站首页>Usage of string slicing
Usage of string slicing
2022-07-25 10:15:00 【Wendianfei】
st[start:end:step] Start , end , step
#!/usr/bin/python
#-*- coding:utf-8 -*-
str = "abcdef"
## Print a character
print str[0]
## Print label 0,1 The characters of , barring 2
print str[0:2]
## Print from page 0 Start , To the first 3 All strings ending in , Excluding the 3 individual
print str[:3]
## Two characters apart , Print from page 0 Start , To the first 3 All strings ending in , Excluding the 3 individual , The last one is step size
print str[:3:2]
## Reverse printing
print str[::-1]
边栏推荐
- ROS distributed operation -- launch file starts nodes on multiple machines
- 史上最全面的UE4 文件操作,打开,读、写,增、删、改、查
- UE4 碰撞(Collsion)
- 车辆属性最近一次入库时间初始化生成sql脚本文件
- See how a junior student of double non-2 (0 Internship) can get an offer from Alibaba and Tencent
- Introduction to armv8 architecture
- 小程序H5获取手机号方案
- struct2的原理
- The first week of the fifth stage
- JSP details
猜你喜欢

【成长必备】我为什么推荐你写博客?愿你多年以后成为你想成为的样子。

Redux使用和剖析

拷贝过来老的项目变成web项目

Introduction to armv8 architecture

Probability theory and mathematical statistics 4 continuous random variables and probability distributions (Part 1)

安装 oh my zsh

rospy Odometry天坑小计

数据库MySQL详解

ROS分布式操作--launch文件启动多个机器上的节点

Copy the old project into a web project
随机推荐
The economic basis of a hardware siege lion
概率论与数理统计 4 Continuous Random Variables and Probability Distributions(连续随机变量与概率分布)(上篇)
关闭brew执行命令时的自动更新
看一个双非二本(0实习)大三学生如何拿到阿里、腾讯的offer
cookie and session
Arm preliminaries
C3D模型pytorch源码逐句详析(二)
Introduction to armv8 architecture
[machine translation] scones -- machine translation with multi tag tasks
Use of dictionary tree
MVC三层架构理解
LOAM 融合 IMU 细节之 TransformToEnd 函数
FPGA basic advanced
VScode配置ROS开发环境:修改代码不生效问题原因及解决方法
小程序分享功能
IO流中的输入流
小程序H5获取手机号方案
JS uses requestanimationframe to detect the FPS frame rate of the current animation in real time
NPM details
nodejs链接mysql报错:ER_NOT_SUPPORTED_AUTH_MODEError: ER_NOT_SUPPORTED_AUTH_MODE