### Reading Files in Python:
To read a file in Python, you use the built-in `open()` function, followed by the `read()` method.
Example:
```python
file = open('example.txt', 'r')
print(file.read())
file.close()
```
In this example, 'example.txt' is the name of the file to be read, and 'r' stands for read mode. The `read()` method is used to read the content of the file. Always remember to close the file after you're done with it using `file.close()`.
Writing Files in Python:
To write to a file in Python, you again use the `open()` function, but this time with 'w' as the second argument (which stands for write). If the file does not exist, Python will create it for you.
Example:
```python
file = open('example.txt', 'w')
file.write("Hello, World!")
file.close()
```
In this example, we write the string "Hello, World!" to the file 'example.txt'. Again, don't forget to close the file with `file.close()`.
Appending Files in Python:
If you want to add content to an existing file without removing the existing content, you can use the 'a' mode.
Example:
```python
file = open('example.txt', 'a')
file.write("\nThis is an appended line.")
file.close()
```
This will add the string "\nThis is an appended line." to a new line at the end of the file.
Remember, always close your files after you're done with them. This is good practice and helps to prevent file corruption and data loss.