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 123 views
123 views asked Aug 20, 2023 by avibootz
1 answer 149 views
1 answer 117 views
1 answer 107 views
107 views asked Aug 18, 2023 by avibootz
1 answer 129 views
...