#bytes和字符串之间的转换
test = 'hello world'
print(type(test))
byte = test.encode('utf-8')
print(type(byte))
string = byte.decode() #decode解码
print(type(string))
F:\python3.8\python.exe 模块.py
<class 'str'>
<class 'bytes'>
<class 'str'>
Process finished with exit code 0
sys模块的使用
import sys
print(sys.argv)
print(sys.argv[1:])
root@kali:/tools/python-security/ssh# python3 tttt.py -a localhost -b 1234
['tttt.py', '-a', 'localhost', '-b', '1234']
['-a', 'localhost', '-b', '1234']
getopt模块的学习