Last active
August 20, 2020 01:00
-
-
Save robinfang/abc707e3cbcd2f576cb99576d2e05098 to your computer and use it in GitHub Desktop.
检查哪些文件是用的windows换行符。我在用git的时候已经被windows换行符和unix换行符的不同恶心好几次了。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
def checkAllPath(allFilePath): | |
for p in allFilePath: | |
# print(p) | |
if p.is_dir(): | |
continue | |
with open(p, "rb") as f: | |
content = f.read() | |
if b"\r\n" in content: | |
print("windows ending: {}".format(p)) | |
if __name__ == '__main__': | |
allFilePath = Path('src').rglob('*') | |
checkAllPath(allFilePath) | |
allFilePath = Path('public').rglob('*') | |
checkAllPath(allFilePath) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment