Question: Convert the AllowedVehiclesList from a List ( Array ) to a File. - - - - - - - - - - - - -

Convert the AllowedVehiclesList from a List (Array) to a File.
---------------------------------------------------
# The list(array) of the dataset
AllowedVehiclesList =['Ford F-150', 'Chevrolet Silverado', 'Tesla CyberTruck', 'Toyota Tundra', 'Rivian R1T', 'Ram 1500']
print(AllowedVehiclesList)
textfile = open('/Users/kacyc/OneDrive/Desktop/AllowedVehiclesList.txt','w')
content ='
'.join(AllowedVehiclesList)
textfile.writelines(content)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!