How To Split Each Line From File To It's Own String In Python? May 03, 2024 Post a Comment I have a file with a bunch of information with this following format: New York Jets I am trying to get each line of the file into it's own string. FoSolution 1: from xml.domimport minidom Copyxmldoc = minidom.parse('filename.txt')itemlist = xmldoc.getElementsByTagName('item')for s in itemlist: print(s.attributes['name'].value)you can read a file having tags like this, and retrieve the values. Share Post a Comment for "How To Split Each Line From File To It's Own String In Python?"
Post a Comment for "How To Split Each Line From File To It's Own String In Python?"