I'm trying to save a list to a text file.
This is my code:
public void button13_Click(object sender, EventArgs e) { TextWriter tw = new StreamWriter("SavedLists.txt"); tw.WriteLine(Lists.verbList); tw.Close(); }
This is what I get in the text file:
System.Collections.Generic.List`1[System.String]
Do I have to use ConvertAll<>
? If so, I'm not sure how to use that.
Python read file into list. To read a file into a list in Python, use the file. read() function to return the entire content of the file as a string and then use the str. split() function to split a text file into a list.
Framework 4: no need to use StreamWriter:
System.IO.File.WriteAllLines("SavedLists.txt", Lists.verbList);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With