Course Creation at DataCamp
Kelsey McNeillie
Instructor Success Manager
Sample code
# Open a file: file
file = open(____,
mode='____')
# Print the file
____
# Check whether file is closed
____(file.closed)
# Close file
____.____()
Solution code
# Open a file: file
file = open('moby_dick.txt',
mode='r')
# Print the file
print(file.read())
# Check whether file is closed
print(file.closed)
# Close file
file.close()
Hotkey | Function |
---|---|
'ctrl' and 'h' (1x) | Show hint |
'ctrl' and 'h' (2x) | Show solution |
Sample code
Solution code
Course Creation at DataCamp