ERROR : TypeError: ord() expected string of length 1, but int found
Run Code Online (Sandbox Code Playgroud)
编译程序时出现此错误.
File "C:\Users\Administrator\Desktop\tracer1.py", line 129, in <module>
get_route("www.google.com")
File "C:\Users\Administrator\Desktop\tracer1.py", line 85, in get_route
d = build_packet()
File "C:\Users\Administrator\Desktop\tracer1.py", line 62, in build_packet
myChecksum = checksum(header + data)
File "C:\Users\Administrator\Desktop\tracer1.py", line 28, in checksum
thisVal = ord(str[count+1]) * 256 + ord(str[count])
**TypeError: ord() expected string of length 1, but int found**
Run Code Online (Sandbox Code Playgroud)
该程序是使用ICMP查找traceroute
from socket import *
import socket
import os
import sys
import struct
import time
import select …Run Code Online (Sandbox Code Playgroud)