scanf

sscanf in Python

sscanf in Python Question: I’m looking for an equivalent to sscanf() in Python. I want to parse /proc/net/* files, in C I could do something like this: int matches = sscanf( buffer, “%*d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %*X %*X:%*X %*X:%*X %*X %*d %*d %ld %*512sn”, local_addr, &local_port, rem_addr, &rem_port, &inode); I thought at first to use str.split, …

Total answers: 9