1:windows下获取当前机器的IP
python3.6
import socket
Compute_name = socket.getfqdn(socket.gethostname()) # get name
Compute_addr = socket.gethostbyname(Compute_name) # get ip
print(Compute_name)
print(Compute_addr)
2.windows下获取当前目录的当前路径
cmd:输入chdir
1:windows下获取当前机器的IP
python3.6
import socket
Compute_name = socket.getfqdn(socket.gethostname()) # get name
Compute_addr = socket.gethostbyname(Compute_name) # get ip
print(Compute_name)
print(Compute_addr)
2.windows下获取当前目录的当前路径
cmd:输入chdir