×××××××××××××××××××××××××××××××
The os module is to help you deal with any operation dealing with the directory.
×××××××××××××××××××××××××××××××
1. import os
2.
3. # todo check for existing file.
4. if os .path.isfile ('./gradebook.dat' ): # check to see if file exists
5. data = open( './gradebook.dat' , 'rb' ) # if file exists open, read all d
6. data.close ()
7. else:
8. print ("The file gradebook.dat was not found.\n" )
9. print ("We will create one....\n" )
×××××××××××××××××××××××××××××××
Thanks for Visiting........
No comments:
Post a Comment