Using List Comprehensions on Files : List Comprehension : List PYTHON TUTORIALS


PYTHON TUTORIALS » List » List Comprehension »

 

Using List Comprehensions on Files


f = open('script1.py')
lines = f.readlines(  )
print lines

lines = [line.rstrip(  ) for line in lines]
print lines



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo List
» List Comprehension