Py4e: Chapter 7- Questions and Answers|
Latest Update
What is the purpose of the newline character in text files? It indicates the end of one line
of text and the beginning of another line of text
If we open a file as follows:
xfile = open('mbox.txt') for line in xfile:
What is the purpose of the following Python code?
fhand = open('mbox.txt')
x=0
for line in fhand:
x=x+1
print(x) Count the lines in the file 'mbox.txt'
If you write a Python program to read a text file and you see extra blank lines in the output that
are not present in the file input as shown below, what Python string function will likely solve the
problem?
From:
From:
Latest Update
What is the purpose of the newline character in text files? It indicates the end of one line
of text and the beginning of another line of text
If we open a file as follows:
xfile = open('mbox.txt') for line in xfile:
What is the purpose of the following Python code?
fhand = open('mbox.txt')
x=0
for line in fhand:
x=x+1
print(x) Count the lines in the file 'mbox.txt'
If you write a Python program to read a text file and you see extra blank lines in the output that
are not present in the file input as shown below, what Python string function will likely solve the
problem?
From:
From: