def Save_hotels():
global numberOfHotels
global My_Hotels
file = open('data.csv', "w", newline="\n")
dataEX = csv.writer(file, delimiter=",")
mylist = [numberOfHotels]
dataEX.writerow(mylist)
for hotel in My_Hotels:
mylist = [hotel.ID,hotel.Name,hotel.Stars,hotel.Rooms]
for i in hotel.Reservations:
res = [i.Customer_Name,i.Date,i.Time]
mylist.extend(res)
dataEX.writerow(mylist)
file.close()
这是错误:
File "D:/Python Projects/Domes Dedomenwn Project(2017)/Main.py", line 54, in
Save_hotels
file = open('data.csv', "w", newline="\n")
PermissionError: [Errno 13] Permission denied: 'data.csv'