maheshnapa
maheshnapa

Reputation: 1

Python File Reading into another text in diff format

my text file look like name1\n name2\n name3\n

I want read this file and store in another text file like this('name1','name2','name3') in Python, Could you please help anyone.

Upvotes: 0

Views: 33

Answers (1)

Shivpe_R
Shivpe_R

Reputation: 1080

YourTextFile = 'name1\n name2\n name3\n'
ListOFNames = YourTextFile.split('\n ')
AllNamesList = [x.replace('\n', '') for x in ListOFNames]

Upvotes: 1

Related Questions