bz2
2022. 7. 20. 20:00ㆍProgramming/python
반응형
>> import bz2
>> str = b"sqlplus scott/tiger"
# compress
>> compress_str = bz2.compress(str)
>> print(compress_str)
b'BZh91AY&SYY\xf9\xdb\xc5\x00\x00\x07\x11\x80@\x00\x8a\xa4\xfe\x00 \x001\x00\x00\x08@d\xf0\xa1X\xedh\x9b\x14\x18~N\xfe.\xe4\x8ap\xa1 \xb3\xf3\xb7\x8a'
# decompress
>> decompress_str = bz2.decompress(compress_str)
>> print(d)
b"sqlplus scott/tiger"
>> print(d.decode())
sqlplus scott/tiger
# 오라클 접속 예시
>> import os
>> os.system(bz2.decompress(compress_str))
https://docs.python.org/3/library/bz2.html
반응형
'Programming > python' 카테고리의 다른 글
동적변수 (0) | 2022.07.28 |
---|