[Solved] Replace text inside .txt file or .xml file using loop [closed]

Using xml linq : using System; using System.Collections.Generic; using System.Collections; using System.Linq; using System.Text; using System.Xml; using System.Xml.Linq; namespace ConsoleApplication { class Program { static void Main(string[] args) { string xml = @”<Root> <Tag1> <USA></USA> <UK></UK> </Tag1> <Tag2> <FRA></FRA> <USA></USA> </Tag2> </Root>”; XDocument doc = XDocument.Parse(xml); List<XElement> tags = doc.Descendants().Where(x => x.Name.LocalName.StartsWith(“Tag”)).ToList(); List<string> countries = … Read more

[Solved] How to convert txt to dictionary in python [closed]

I’ve added comments to the answer to explain the flow, please add more details in your question if this is not clear enough 🙂 # Open file for reading file_house_price = open(“house_price.txt”, “r”) # read all lines from the file into a variable data_house_price = file_house_price.readlines() # as we’re done with the file, we can … Read more