Single Choice
Difficult
QWhich of the following expression can be used to check if the file 'C:\Sample.txt' exists and is also a regular file?
ID: #20270
Create Objects in Python
194 views
Question Info
#20270Q ID
DifficultDifficulty
Create Objects in PythonTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
The correct expression to check if the file 'C:\Sample.txt' exists and is also a regular file is:
os.path.isfile("C:\Sample.txt")
So, the correct answer is: os.path.isfile("C:\Sample.txt")
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic