Created
April 30, 2024 12:22
-
-
Save search5/8724b177d602f68a45a9c6858d88d012 to your computer and use it in GitHub Desktop.
파이썬 버전 추출
This file contains hidden or 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
# python --version 명령 실행 | |
$pythonVersionOutput = python --version | |
# 버전 문자열에서 숫자 부분 추출 | |
$pythonVersion = $pythonVersionOutput -replace 'Python ', '' | |
# 첫 번째와 두 번째 숫자 추출 | |
$majorMinorVersion = $pythonVersion -replace '^(\d+)\.(\d+).*', '$1$2' | |
# 숫자로 변환 | |
$PY_VER = [int]$majorMinorVersion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment