라벨이 sys인 게시물 표시

파이썬[Python]: sys - platlibdir 변수

sys 모듈 - platlibdir 변수(variable) /// 설명 플래폼 종속 라이브러리 디렉토리의 이름입니다. 표준 라이브러리와 확장 모듈을 설치하기 위한 경로를 지칭합니다. ※ 형식 sys.platlibdir /// 예제 1 2 3 4 5 6 7 import  sys   print (sys.platlibdir)   # lib   #                                              _____ # 'C:\\Users\\psych\\anaconda3\\envs\\Practice\\lib\\os.py'>   Colored by Color Scripter cs * 실행환경: Microsoft Windows 10 Homes * 인터프리터: 파이썬(Python 3.9) – 당신을 응원합니다. –

파이썬[Python]: sys - platform 변수

sys 모듈 - platform 변수(variable) /// 설명 플래폼을 나타내는 지시자입니다. ※ 형식 sys.platform /// 예제 1 2 3 4 5 6 7 8 9 10 11 12 13 import  sys   print (sys.platform)   # win32 print (sys.platform.startswith( 'linux' ))   # False   # recommended if  sys.platform.startswith( 'win32' ):      print ( 'win32' ) elif  sys.platform.startswith( 'linux' ):      print ( 'linux' ) # elif ... # elif ...   Colored by Color Scripter cs * 실행환경: Microsoft Windows 10 Homes * 인터프리터: 파이썬(Python 3.9) – 당신을 응원합니다. –

파이썬[Python]: sys - path_importer_cache 변수

sys 모듈 - path_importer_cache 변수(variable) /// 설명 파인더 객체를 위한 캐쉬로서의 디렉토리입니다. 딕셔너리에서 'key'는 sys.path_hooks 에 의해 전달되어진 경로이고, 'value'는 발견된 파인더 입니다. ※ 형식 sys.path_importer_cache /// 예제 1 2 3 4 5 import  sys   print (sys.path_importer_cache) # {'D:\\......\\Computer_Program\\Py\\Practice': FileFinder('D:\\......\\Computer_Program\\Py\\Practice'), 'C:\\Users\\psych\\anaconda3\\envs\\Practice\\python39.zip': None, ......   Colored by Color Scripter cs * 실행환경: Microsoft Windows 10 Homes * 인터프리터: 파이썬(Python 3.9) – 당신을 응원합니다. –

파이썬[Python]: sys - path_hooks 변수

sys 모듈 - path_hooks 변수(variable) /// 설명 파인더(finder)를 생성하기 위해 경로를 인자로 갖을 수 있는 콜러블의 리스트를 반환합니다. ※ 형식 sys.path_hooks /// 예제 1 2 3 4 5 import  sys   print (sys.path_hooks) # [<class 'zipimport.zipimporter'>, <function FileFinder.path_hook.<locals>.path_hook_for_FileFinder at 0x000002934E4F1D30>]   Colored by Color Scripter cs * 실행환경: Microsoft Windows 10 Homes * 인터프리터: 파이썬(Python 3.9) – 당신을 응원합니다. –

파이썬[Python]: sys - argv 변수

sys 모듈 - argv 변수(variable) /// 설명 모듈과 관련된 특정 경로들의 문자열 리스트를 반환합니다. 이 값은 환경변수 PYTHONPATH 에 의해 초기화됩니다. ※ 형식 sys.argv /// 예제 1 2 3 4 5 import  sys   print (sys.path) # ['D:\\......\\Computer_Program\\Py\\Practice', 'D:\\......\\Computer_Program\\Py\\Practice', 'C:\\Users\\psych\\anaconda3\\envs\\Practice\\python39.zip', ......   Colored by Color Scripter cs * 실행환경: Microsoft Windows 10 Homes * 인터프리터: 파이썬(Python 3.9) – 당신을 응원합니다. –

파이썬[Python]: sys - argv 변수

sys 모듈 - argv 변수(variable) /// 설명 파이썬 스크립트에 의해 전달되어진 명령어 인터페이스(command line)의 인자들을 출력합니다. ※ 형식 sys.argv /// 예제 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 import  sys   # try using Terminal # # python filename.py  arg1  arg2  ...... #         argv[0]   argv[1] argv[2] ...... # # command was executed using the -c command line option # python filename.py  arg1  arg2  ...... #                   argv[0] argv[1]  ......   print (sys.argv) # PS D:\......\Computer_Program\Py\Practice> python main.py -s -v # ['main.py', '-s', '-v']   Colored by Color Scripter cs * 실행환경: Microsoft Windows 10 Homes * 인터프리터: 파이썬(Python 3.9) – 당신을 응원합니다. –

파이썬[Python]: sys - modules 변수

sys 모듈 - modules 변수(variable) /// 설명 모듈 이름과 현재 적재(loaded)되어 있는 모듈이 표현되어 있는 딕셔너리를 반환합니다. 딕셔너리를 치환하는 것은 파이썬의 오류를 야기할 수 있습니다. 대신, sys.modules.copy() 나 tuple(sys.modules)를 사용하시기 바랍니다. ※ 형식 sys.modules /// 예제 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 import  sys from  pprint  import  pprint   pprint(sys.modules.copy())   # {'__main__': <module '__main__' from 'D:\\......\\Computer_Program\\Py\\Practice\\main.py'>, #  '_abc': <module '_abc' (built-in)>, #  '_bootlocale': <module '_bootlocale' from 'C:\\Users\\psych\\anaconda3\\envs\\Practice\\lib\\_bootlocale.py'>, #  '_codecs': <module '_codecs' (built-in)>, #  '_codecs_kr': <module '_codecs_kr' (built-in)>, #  '_c

파이썬[Python]: sys - maxunicode 변수

sys 모듈 - maxunicode 변수(variable) /// 설명 가장 큰 유니코드의 코드포인트를 반환합니다. ※ 형식 sys.maxunicode /// 예제 1 2 3 4 5 6 7 import  sys   print (sys.maxunicode)   # 1114111 print ( '{:0X}' . format (sys.maxunicode))   # 10FFFF   # U+0000 ~ U+10FFFF   Colored by Color Scripter cs * 실행환경: Microsoft Windows 10 Homes * 인터프리터: 파이썬(Python 3.9) – 당신을 응원합니다. –

파이썬[Python]: sys - hash_info 상수

sys 모듈 - hash_info 상수(constatn) /// 설명 numeric 해시를 구현하기 위한 속성들을 반환합니다. named 튜플 ※ 형식 sys.hash_info /// 예제 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 import  sys   # built-in: hash() print (sys.hash_info) # sys.hash_info(width=64, modulus=2305843009213693951, inf=314159, nan=0, # imag=1000003, algorithm='siphash24', hash_bits=64, seed_bits=128, cutoff=0)   # width = bits used for hash values (64 bits with 128 seed_bits) # modulus = a mod P, P is a prime # inf = hash value returned for a positive infinity # non = ? # imag = multiplier used for the imaginary part of a complex number # algorithm = name of the algorithm # hash_bits = output # seed_bits = secret key(random value) # cutoff = ?   Colored by Color Scripter cs * 실행환경: Microsoft Windows 10 Homes * 인터프리터: 파이썬(Python 3.9) – 당신을 응원합니다. –

파이썬[Python]: sys - getdefaultencoding 함수

sys 모듈 - getdefaultencoding 함수(function) /// 설명 현재 유니코드 구현을 위한 인코딩 방식을 반환합니다. ※ 형식 sys.getdefaultencoding() /// 예제 1 2 3 4 import  sys   print (sys.getdefaultencoding())   # utf-8   Colored by Color Scripter cs * 실행환경: Microsoft Windows 10 Homes * 인터프리터: 파이썬(Python 3.9) – 당신을 응원합니다. –

파이썬[Python]: sys - executable 변수

sys 모듈 - executable 변수(variable) /// 설명 파이썬 인터프리터가 실행되어지는 절대경로를 표시합니다. 만약 실행경로를 찾을 수 없다면, 빈 문자열이나 None을 표시합니다. 참고: platform.architecture() ※ 형식 sys.executable reference https://docs.python.org/3/library/sys.html#module-sys /// 예제 1 2 3 4 5 import  sys   print (sys.executable) # c:\Users\psych\anaconda3\envs\Practice\python.exe   Colored by Color Scripter cs * 실행환경: Microsoft Windows 10 Homes * 인터프리터: 파이썬(Python 3.9) – 당신을 응원합니다. –

파이썬[Python]: sys - base_prefix 변수

sys 모듈 - base_prefix 변수(variable) /// 설명 site.py가 실행되기 전 exec_prefix의 값과 같은 값으로 파이썬 startup 시기에 설정됩니다. 만약 가상환경에서 실행되어진다면 exec_prefix의 값은 가상환경에 맞게 변하지만, 이 값은 변하지 않습니다. ※ 형식 sys.base_prefix /// 예제 1 2 3 4 5 import  sys   print (sys.base_prefix) # C:\Users\psych\anaconda3\envs\Practice   Colored by Color Scripter cs * 실행환경: Microsoft Windows 10 Homes * 인터프리터: 파이썬(Python 3.9) – 당신을 응원합니다. –

파이썬[Python]: sys - prefix 변수

sys 모듈 - prefix 변수(variable) /// 설명 파이썬이 설치되어지는 디렉토리를 표시합니다. 기본값은 설치시 변경하실 수 있습니다. 가상환경을 실행시는 가상환경의 실행되는 디렉토리를 표시합니다. ※ 형식 sys.prefix /// 예제 1 2 3 4 5 import  sys   print (sys.prefix) # C:\Users\psych\anaconda3\envs\Practice   Colored by Color Scripter cs * 실행환경: Microsoft Windows 10 Homes * 인터프리터: 파이썬(Python 3.9) – 당신을 응원합니다. –

파이썬[Python]: sys - base_exec_prefix 변수

sys 모듈 - base_exec_prefix 변수(variable) /// 설명 site.py가 실행되기 전 exec_prefix의 값과 같은 값으로 파이썬 startup 시기에 설정됩니다. 만약 가상환경에서 실행되어진다면 exec_prefix의 값은 가상환경에 맞게 변하지만, 이 값은 변하지 않습니다. ※ 형식 sys.base_exec_prefix /// 예제 1 2 3 4 5 import  sys   print (sys.base_exec_prefix) # C:\Users\psych\anaconda3\envs\Practice   Colored by Color Scripter cs * 실행환경: Microsoft Windows 10 Homes * 인터프리터: 파이썬(Python 3.9) – 당신을 응원합니다. –

파이썬[Python]: sys - exec_prefix 변수

sys 모듈 - exec_prefix 변수(variable) /// 설명 파이썬이 설치되어지는 디렉토리를 표시합니다. 기본값은 설치시 변경하실 수 있습니다. 가상환경을 실행시는 가상환경의 실행되는 디렉토리를 표시합니다. ※ 형식 sys.exec_prefix /// 예제 1 2 3 4 import  sys   print (sys.exec_prefix) # C:\Users\psych\anaconda3\envs\Practice cs * 실행환경: Microsoft Windows 10 Homes * 인터프리터: 파이썬(Python 3.9) – 당신을 응원합니다. –

파이썬[Python]: sys - maxsize 변수

sys 모듈 - maxsize 변수(variable) /// 설명 정수형(integer: Py_ssize_t Type)의 최대 값을 알 수 있습니다. 32-bit: 2 31 - 1, 64bit: 2 63 - 1 ※ 형식 sys.maxsize /// 예제 1 2 3 import  sys   print (sys.maxsize) cs * 실행환경: Microsoft Windows 10 Homes * 인터프리터: 파이썬(Python 3.9) – 당신을 응원합니다. –

파이썬[Python]: sys - breakpointhook 함수

파이썬(Phthon): sys 모듈 - breakpointhook 함수(function) /// 설명 내장함수 breakpoint()에 의해 호출되는 hook함수입니다. 기본값으로 pdb 디버거를 사용하지만 다른 디버거를 사용할 수 있습니다. 이 함수의 시그니쳐(signature)는 어떤 함수를 호출하느냐에 달려있습니다. 예를 들어 기본값으로 연결(binding)되어 있는 pdb.set_trace()는 인자를 사용하지 않을 수도 있지만, 다른 함수와 연결할 경우에는 필요할 수 있습니다. 내장함수 breakpoint()의 인자를 그대로 전달하며, breakpointhook()이 돌려주는 값은 breakpoint()에 전달됩니다. 환경변수 PYTHONBREAKPOINT 1. '0' : no-op 2. not set or empty string : calls pdb.set_trace() 3. set callable function() : calls callable function (e.g. os.environ['PYTHONBREAKPOINT'] = 'foo.bar.baz' : import foo.bar and calls foo.bar.baz()) using 파이썬의 dotted-import nomenclature 만약 sys.breakpointhook()이 오버라이드(PYTHONBREAKPOINT를 사용하지 않게끔) 된다면, PYTHONBREAKPOINT를 확인하지 않습니다. ※ 형식 sys.breakpointhook() /// 예제 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 import  sys   test_int1  =   10 test_int2  =   - 10   test_binary1  =  bin(test_int1) test_binary2  =  bin(test_int2)   # os.environ['PYTHONBREAKPOINT'