How to get rid the new line

Eric Texier erict at millfilm.co.uk
Thu Jun 27 16:06:31 CEST 2002


## remove all the leading and tail white space
line = string.strip(aline)
if line:
    # this is an emptyLine


or better

    def   isNotEmpTxt(text):
        empty = re.compile('^\s*$')
        if empty.match( text):
                return 0
        else:
                return 1




SiverFish wrote:

> Anyone tell me how to skip the empty line when you read through the file
> and copy the information in to the list(no empty line )




More information about the Python-list mailing list