I have a text file with lines going like this: text1:numbers:text2
. How do I separate these so that I can output for example text1:text2:numbers
to another file?
file1=open("textfile.txt","r")
file2=open("textfile2.txt","w")
while True:
line=file1.readline()
a=line.split(":")
if line=="":break