python 3

특정 폴더 내 파일 파싱(parsing)하여 IP 검출

특정 폴더 내 모든 파일에서 IP 같은 내역을 뽑아 내기IP 패턴 정의 : ip_pattern = re.compile(r'\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b')import os import re import pandas as pd def find_ips_in_file(file_path):     """Find all IP addresses in a given file."""     ip_pattern = re.compile(r'\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b')     ips = []     with open(file_path, 'r', errors='ignore') as file:         content = file.read()         ..

python 2024.08.06

[Python] 오프라인 환경에서 패키지 설치

온라인 환경에서 테스트가 끝났다면 해당 패키지를 별도 폴더에 옮겨야 한다.아래 방법으로 하게 특정 폴더에 의존성까지 체크해서 다운로드 받게 된다.pip download 패키지명 -d /폴더경로vertica-python 패키지를 의존성까지 체크 후 관련 패키지를 vertica_db\package 폴더에 다운로드C:\Users\DBInc>pip download vertica-python -d C:\Users\DBInc\Downloads\vertica_db\package Collecting vertica-python   Using cached vertica_python-1.3.8-py3-none-any.whl.metadata (1.5 kB) Collecting python-dateutil>=1.5 (from ..

python 2024.06.29