如何删除字符串中字符左侧的所有字符
这是在示例字符串上:
nomigo* tatra rr rr rr rr rr rr eee e rr kh美元(US $ 547,560.00
我试图删除左侧的“任何”或随机字符(我们(在Python中)注意此示例中的字符是此示例中的字符是它们会改变。 (我们 字符的数量可以 也改变。
Here is on sample string:
NOMIGO* TATRA RR ER RR RR RA EEE E RR KH Dollars (U.S. $547,560.00
I am trying to remove "any" or random characters to the left of (U.S. (in Python) note the characters in this example are random and they will change. It needs to work with any characters present to the left of
(U.S
The number of characters could
also change.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用切片
输出:( US $ 547,560.00
You can use slicing
Output: (U.S. $547,560.00
用
在
上拆分值
用split_value = value.split(“ us”)
将字符串
value
拆分为两个子弦:并且
您想要第二个子字符串,该子字符串存储在索引
1
split the value at
"U.S."
withsplit_value = value.split("U.S.")
This will split the string
value
into two sub-strings :and
You want the second substring which is stored at index
1