I have a file named 187045_20191025_Release_UAT_1.zip. I want to get 187045 and 1 at the end.
I have used this code snippet, but it is not giving me what I want.
cms_name = splitext(split('187045_20191025_Release_UAT_1.zip')[1])[0].rsplit('_', 1)
print(cms_name)
This is the output.
['187045_20191025_Release_UAT', '1']
cms_name must give me just 187045. It is obvious that I am making a mistake somewhere.
Please guide me.
Regards
rsplitdoes), and setting limit o1. You've probably copied this code and are unsure of what it does. Check out the string docs, it is quite clear that you needsplitherecms_name = '187045_20191025_Release_UAT_1.zip'.split('_'), and thenprint(cms_name[0], cms_name[1])?