I want to get the username with max suffix. So, the output for the res should be user0002. I want to ignore if the Username doesn't contain prefix user
(this data actually throws exception). How to put the condition in lambda function to ignore the prefix other than user
.
res = [{ "Username": "user0001"},{ "Username": "user0002"} {"Username": "test"}]
max_user_id = max(res, key=lambda x:int(x['Username'].split("user")[1]))