the-raspberry-pi-guy / lcd

This repository contains all of the code for interfacing with a 16x2 Character I2C LCD Display. This accompanies my YouTube tutorial here: https://www.youtube.com/watch?v=fR5XhHYzUK0
186 stars 107 forks source link

Display IP adress #59

Closed Mikes-Git closed 1 year ago

Mikes-Git commented 1 year ago

@Sierra007117 Displaying the IP Address shows following:

b'[IP Address]'

how can I get the b and the '' not to be displayed?

Is there a way to display the port as well?

cgomesu commented 1 year ago

user ignored the issue template.

msneloy commented 1 year ago

The 'b' prefix in front of the IP address indicates that it is a bytes object, rather than a string. To remove the prefix and the quotes, you can use the decode() method to convert the bytes object to a string.

As for the port, between the protocols User Datagram Protocol (UDP) and Transmission Control Protocol (TCP), there are 65,535 ports available for communication between devices. If you meant the port used for SSH, you could modify the check_output command to run the sshd command with the -T flag, which displays the port number used for SSH.