, in if, : -
def DateZoneCity_downloaded_previously(Order_Date,ZoneCity):
string_to_match = Order_Date.strftime('%Y/%m/%d') + "-" + ZoneCity[0] + "-" + ZoneCity[1]
if string_to_match in open(Record_File).read():
return True
while, record_file , , : -
def DateZoneCity_downloaded_previously(Order_Date, ZoneCity):
string_to_match = Order_Date.strftime('%Y/%m/%d') + "-" + ZoneCity[0] + "-" + ZoneCity[1]
with open(Record_File) as download_status:
return is_empty((string_to_match in line) for line in download_status)
since reading line by line will save the memory used to save the line.
source
share