Re: reading text files with indentation

2014-07-28 Thread Gary Herron
On 07/27/2014 11:25 PM, Noah wrote: Hi there, The following code I am using to read in lines from a text file. The indentation of the text is getting lost. How can I correct that? for file in files: with open (file, "r") as file: lines = file.readlines() for line

Re: reading text files with indentation

2014-07-28 Thread Peter Otten
Noah wrote: > Hi there, > > The following code I am using to read in lines from a text file. The > indentation of the text is getting lost. How can I correct that? > > > for file in files: >with open (file, "r") as file: > lines = file.readlines() > > for line in lines: >

reading text files with indentation

2014-07-28 Thread Noah
Hi there, The following code I am using to read in lines from a text file. The indentation of the text is getting lost. How can I correct that? for file in files: with open (file, "r") as file: lines = file.readlines() for line in lines: line = r