Python में write() function क्या return करता है?
What does the write() function return in Python?
A
True or False
B
Nothing
C
Number of characters written
D
The file name
Explanation
Python में जब आप किसी file में कुछ लिखते हैं:
f = open("demo.txt", "w")
chars_written = f.write("Hello")
print(chars_written) # Output: 5
➡ write() function उस string में लिखे गए characters की संख्या return करता है।
🔹 Example:
f = open("file.txt", "w")
result = f.write("Python")
print(result)
# Output: 6 (क्योंकि "Python" में 6 characters हैं)
Correct Answer: C) Number of characters written