Browse Source

Upload files to ''

Reggie 2 years ago
parent
commit
3cdaef69a3
1 changed files with 18 additions and 0 deletions
  1. 18 0
      main.py

+ 18 - 0
main.py

@@ -0,0 +1,18 @@
+'''Для обработки MAC-ов LAN
+   Приводит маки к виду xxxx.xxxx.xxxx
+'''
+
+file_write = open("output.txt", 'w', encoding='utf-8')
+with open("1.txt", 'r', encoding="utf-8") as r_file:
+    while True:
+        line = r_file.readline()
+        if not line:
+            break
+        # Удаление лишних символов
+        if '-' in line or ':' in line:
+            line = line.replace("-", ".").replace(":", ".").replace("\n", "").lower() 
+            line = line[0:2]+''+line[3:5]+''+line[5:8]+''+line[9:12]+line[12:14]+''+line[15:] 
+            file_write.write(line+'\n')
+            continue
+        else:
+            file_write.write(line)