Answers for "# read and write a text file"

5

write text files with C#

// Create a file to write to.
string createText = "Hello and Welcome" + Environment.NewLine;
File.WriteAllText(path, createText);

...

// Open the file to read from.
string readText = File.ReadAllText(path);
Posted by: Guest on October-23-2020
0

# read and write a text file

# read Text from File
def read_file(filename):
    with open(filename, encoding='utf-8') as file:
        return file.readlines()
      
     
# write Text to File
def write_to_file(filename, text):
    with open(filename, 'w', encoding='utf-8') as file:
        file.write(text)
Posted by: Guest on March-30-2022

Code answers related to "# read and write a text file"

Python Answers by Framework

Browse Popular Code Answers by Language