How to delete all blank lines in the file with the help of python?
Question: For example, we have some file like that:

> first line  
>  second line  
>  
>  third line

And in result we have to get:

> first line  
>  second line  
>  third line

Use ONLY python


Answer: 
    import fileinput
    for line in fileinput.FileInput("file",inplace=1):
        if line.rstrip():
            print line
    

