Question: This is my code: How to remove the space below without modifying the strings from the print function? def get_part(text, index): return (text.replace( ,).strip().split('|')[index:index+1]) print(get_part('
This is my code:

How to remove the space below without modifying the strings from the print function?
![the strings from the print function? def get_part(text, index): return (text.replace(" ","").strip().split('|')[index:index+1])](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f06a71bf65f_92166f06a716da13.jpg)
def get_part(text, index): return (text.replace(" ","").strip().split('|')[index:index+1]) print(get_part(' John Doe | Male | ,0)) print(get_part('John Doe | Male | X,2)) print(get_part('Dog|Cat',, 0) ) [JohnDoe][X][Dog]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
