вы можете использовать список для хранения значений
Пример:
#after reading the file - output "a|b|c|d"
out = "a|b|c|d"
out = out.split("|") #will output ["a", "b", "c", "d"]
#here you can change the values of the list
#re-creating string with separators
for i in range(0, len(out) * 2, 2):
out.insert(i, "|")
out = "".join(out)
Это должно дать вам желаемый результат. чтобы открыть файлы, сделайте это file = open("filename.ext", "(w) for write or (r) for read only")
, затем введите do file.write("text")
, чтобы прочитать все сразу: file.read()
и получить строки do file.readlines(amount of lines to read - leave blank for all lines)
. Надеюсь, это может быть полезно.