Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Tue Feb 4 01:07:40 2020
- @author: Seow Khaiwen
- """
- def split_string(string):
- list_string = string.split(':')
- return list_string
- def join_string(list_string):
- string = '\n'.join(list_string)
- return string
- if __name__=="__main__":
- f = open(r"D:\Users\abc.txt")
- if f.mode=="r":
- data=f.read()
- list_string=split_string(data)
- new_string=join_string(list_string)
- new_string_1=new_string.replace("1","one")
- new_string_2=new_string_1.replace("2","two")
- new_string_3=new_string_2.replace("3","three")
- new_string_4=new_string_3.replace("'","")
- new_string_5=new_string_4.replace("[","")
- new_string_6=new_string_5.replace("]","")
- print(new_string_6)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement