In Java, there is a replace method that switches certain characters, so I looked for it in Python.
https://www.geeksforgeeks.org/python-string-replace/
I think you can use the replace method on each string while looking up the list.
// java grammar.
List<String> new_list = new ArrayList<>();
for(String str : my_list) {
new_list.add(str.replace("\n", "@"));
}
If you don't understand, I'll read the Python repeat and write it again~
// Python grammar.
for i in range(len(my_list)):
my_list[i] = my_list[i].replace("\n", "@")
print my_list
I didn't know Python well, so I hurriedly watched it and made it into a code executor!
© 2024 OneMinuteCode. All rights reserved.