📌  相关文章
📜  在python代码示例中获取一段字符串

📅  最后修改于: 2022-03-11 14:47:04.101000             🧑  作者: Mango

代码示例2
my_string = "Hey, This is a sample text"
print(my_string[2:]) #prints y, This is a sample text
print(my_string[2:7]) #prints y, Th excluding the last index
print(my_string[2::2]) #prints y hsi  apetx
print(my_string[::-1]) #reverses the string => txet elpmas a si sihT ,yeH