当前位置:网站首页>字符串切片的用法
字符串切片的用法
2022-07-25 09:25:00 【温殿飞】
st[start:end:step] 开始,结束,步长
#!/usr/bin/python
#-*- coding:utf-8 -*-
str = "abcdef"
##打印某个字符
print str[0]
##打印标号0,1的字符,不包括2
print str[0:2]
##打印从第0个开始,到第3个结束的所有字符串,不包括第3个
print str[:3]
##隔两个字符,打印从第0个开始,到第3个结束的所有字符串,不包括第3个,最后一位是步长
print str[:3:2]
##反向打印
print str[::-1]
边栏推荐
猜你喜欢

C语言基础

Data viewing and parameter modification of multi-channel vibrating wire, temperature and analog sensing signal acquisition instrument

NLM5系列无线振弦传感采集仪的工作模式及休眠模式下状态

SystemVerilog syntax

SystemVerilog语法

CCF 201509-4 Expressway

Mlx90640 infrared thermal imager temperature measurement module development notes (I)

CCF 201509-3 模板生成系统

@5-1 CCF 2019-12-1 reporting

【RNN】剖析RNN 之 从RNN-(Simple|LSTM) 到 序列生成 再到 seq2seq框架(encoder-decoder,或称为seq2seq)
随机推荐
Connection and data reading of hand-held vibrating wire vh501tc collector sensor
CCF 201604-2 Tetris
【RNN】剖析RNN 之 从RNN-(Simple|LSTM) 到 序列生成 再到 seq2seq框架(encoder-decoder,或称为seq2seq)
¥ 1-2 example 2.2 put the union of two sets into the linear table
C语言基础
testbench简介
一个硬件攻城狮的经济学基础
ROS分布式操作--launch文件启动多个机器上的节点
Introduction to arm GIC
TensorFlow raw_ RNN - implement the seq2seq mode to take the output of the previous time as the input of the next time
SD/SDIO/EMMC
Terminal definition and wiring of bsp3 power monitor (power monitor)
ARM GIC简介
ISP图像信号处理
数字IC设计SOC入门进阶
Es6详解
rospy Odometry天坑小计
Solve the Chinese garbled code error of qtcreator compiling with vs
工程监测无线中继采集仪和无线网络的优势
TM1638 LED数码显示模块ARDUINO驱动代码