Back to index

python3.2  3.2.2
Functions
crlf Namespace Reference

Functions

def main

Function Documentation

def crlf.main ( void  )

Definition at line 6 of file crlf.py.

00006 
00007 def main():
00008     for filename in sys.argv[1:]:
00009         if os.path.isdir(filename):
00010             print(filename, "Directory!")
00011             continue
00012         with open(filename, "rb") as f:
00013             data = f.read()
00014         if b'\0' in data:
00015             print(filename, "Binary!")
00016             continue
00017         newdata = data.replace(b"\r\n", b"\n")
00018         if newdata != data:
00019             print(filename)
00020             with open(filename, "wb") as f:
00021                 f.write(newdata)