删除字符串的第一个字符 [英] Remove the first character of a string

查看:93
本文介绍了删除字符串的第一个字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想删除字符串的第一个字符.

I would like to remove the first character of a string.

例如,我的字符串以 : 开头,我只想删除它.字符串中出现多次 : 不应删除.

For example, my string starts with a : and I want to remove that only. There are several occurrences of : in the string that shouldn't be removed.

我正在用 Python 编写代码.

I am writing my code in Python.

推荐答案

python 2.x

s = ":dfa:sif:e"
print s[1:]

python 3.x

s = ":dfa:sif:e"
print(s[1:])

两张照片

dfa:sif:e

这篇关于删除字符串的第一个字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆