How to split the last part of a string in Python

1 Answer

0 votes
s = "c c# c++ java python"

last_part = s.rsplit(' ', 1)[-1]

print(last_part) 



'''
run:

python

'''

 



answered Aug 18, 2023 by avibootz

Related questions

1 answer 112 views
112 views asked Aug 20, 2023 by avibootz
1 answer 138 views
1 answer 106 views
1 answer 99 views
1 answer 122 views
...