Quick actions

cmd+k|ctrl+k

Navigation

Languages

: to |

Snippet info

Language

Python

Visibility

public

Author

fjrbgs

Created

2023-07-21T13:04:07.057782Z

Updated

2023-07-21T13:04:07.057782Z

# Example text input as an array
text_array = []

# Function to replace ":" with "|"
def replace_colon_with_pipe(text):
    return text.replace(":", "|")

# Applying the function to each element in the input array
output_array = [replace_colon_with_pipe(text) for text in text_array]

print(output_array)
# Output: ['text1|text2', 'text3|text4', 'text5|text6']
INFO