Question

Write Python code to perform the following:

(i) Copy content of file first.txt to second.txt

 

(ii) Reading a file

 

(iii) Writing into a file

 

(iv) Appending into a file

 

14 May 2025
Answer :
Word Count : 434

(i) Copy content of file first.txt to second.txt in Python:

```python
with open('first.txt', 'r') as file1:
    content = file1.read()

with open('second.txt', 'w') as file2:
    file2.write(content)
```

(ii) Reading a file in Python:

```python
with open('filename.txt', 'r') as file:
    data = file.read()
    print(data)
```

(iii) Writing into a file in Python:

```python
with open('filename.txt', 'w') as ___ ______ ______ _________ ________ _________.
___ _____ _______ _____ _____ _____ ____ ___ __________ _______ ________.
_____ _________ ______ ________ ____ _____ ________ _______ ________ ___ _________.
_________ __________ __________ ___ ___ _____ _______ __________ ______ ____ ______.
_______ ______ __________ ______ _____ __________ ________ _________ _________ _____.
__________ ___ ____ ______ ____ ________ _____.
_______ _______ _______ ___ ___ __________ _______.
___ ____ ______ ________ _____.
_________ ____ ________ _________ ________ ___ ________ _______ _______ ________ _________ ____.
_____ ________ ____ _________ _______ _________ ________ __________ ______ ___ ___.
___ _________ _______ ______ __________.
____ ______ ____ _________ _________ _______ _____ ______.
________ _____ ____ _______ _________ _________ _____ ________.
___ _____ ___ _____ ____ ____ ______ ________ __________ __________ __________.
_____ ____ ___ ________ ______ __________ _________ _________ _________ ___.
__________ ____ _________ ___ _____ ___ ________ _________.
__________ _______ _________ ______ ____ __________ _______ _________ ______.
_____ ________ _______ ______ ____ _____ ______ _____ ______.
___ __________ _____ ____ _________ _________ ____ __________ _______ _______ ________ ____.
______ _____ ______ ___ ________ _______ _______ _______ _________.
__________ ______ ___ _________ __________ ____ _______ ________.
___ __________ _________ _______ __________.
____ _____ ________ _____ _____ ________ _________ _______ _____ _______ __________ __________.
__________ _________ _______ _______ __________ ________ ___ ________ _____ ____ ___ _____.
_______ __________ ____ __________ __________.
__________ _________ ___ _______ _________ ________ _________ _________ _________.
___ ________ ___ _________ __________ ________.
___ ________ __________ ________ _____ _________ ______ _______ __________ ________ _______ ______.
_________ _____ ____ ____ _______ ___ _____ __________ ________.
____ ___ __________ ______ ___.
______ ______ _____ __________ __________ __________.
__________ ____ ___ ________ _____ ________.
________ ______ _________ ___ ______ ___ _______ ______.
_______ ___ ___ ______ ________ ________ _______ ________.
______ _____ ______ _________ ___ ___ _______ ________ ______.
_________ ______ ________ ___ _________ _____ _____.
__________ ________ _________ ________ _________ _______ ___ _____.
______ ____ ______ _______ __________ _________ ___ _______ ___.
_________ ___ ___ ___ ________ __________ ____ ____.
___ _____ ______ _________ _________ _________ __________ ___ _______ _________.
_________ _____ _________ ______ ___ ____ ___ __________ _________ ____ _______ ________.
_____ ___ ________ _______ ______.
________ ______ ___.
Get Full Answer on WhatsApp

IGNOU NEWS
Assignment Submission Last Date Extended Till 30 June 2026 Click Here★★★IGNOU June 2026 TEE Date Sheet Released Click Here★★★
Top
📞
Call Support Instant phone assistance Write Python code to perform the following:(i) Copy content of fil
🟢
WhatsApp Chat Fast live messaging
Email Us Business enquiries & support