Issue
Hello i have this list:
original_list = ['1 b Victor','1 b Pedro','1 b Laura','1 b Maria']
I wanna remove "1 b" from each value of the list and reach at this example list:
final_result = ['Victor', 'Pedro', 'Laura', 'Maria']
How can i do this, please?
Solution
Call str.replace()
in a list comprehension.
final_result = [s.replace('1 b ', '') for s in original_list]
Answered By - Barmar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.