Python 中的高级字符串操作
我试图从以下字符串中仅获取字符串 2021 之后的值:
Revenue Earnings
Year
2018 110360000000 16571000000
2019 125843000000 39240000000
2020 143015000000 44281000000
2021 168088000000 61271000000
我需要将这两个值分开(在本例中,第一个值必须是 168088000000,第二个值必须是 61271000000)。
它们必须在 2021 之前(结果应该只给出我上面提到的 2 个数字,因此,例如,如果有值 2022 和其他数字,则不应采用它们)。
结果应为 a=168088000000 b=61271000000 均为字符串。
I'm trying to get only the value that are after the string 2021 from the following string:
Revenue Earnings
Year
2018 110360000000 16571000000
2019 125843000000 39240000000
2020 143015000000 44281000000
2021 168088000000 61271000000
I need to get those 2 values separated (first one has to be 168088000000 and the second one has to be 61271000000 in this case).
They have to be preceded by 2021 (and the result should give only the 2 numbers I mentioned above so for example if there is a value 2022 and others numbers they should not be taken).
The result should be a=168088000000 b=61271000000 both as strings.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想你可以从中得到启发:
I think you can get inspired by this: