Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

file open in python

with open("cars.txt") as cars:   #open cars.txt file declaration  cars variable then assign cars.txt data
  	blue_cars = cars.read() #read cars.txt data and assign to blue_cars
    #advantage using this, implicitly applied cars.close() method

 ------Similar to ----
cars = open("cars.txt")
blue_cars = cars.read()
cars.close()
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #file #open #python
ADD COMMENT
Topic
Name
6+6 =