examples/python: avoid Python2 "print" statement

Recent python-black (22.0) dropped support for Python 2 and thus fail
for those files. Make the examples Python3 compatible.
This commit is contained in:
Thomas Haller
2022-02-14 16:57:53 +01:00
parent 164840a33c
commit 95e6a0a6e2
3 changed files with 28 additions and 22 deletions

View File

@@ -15,22 +15,28 @@ if __name__ == "__main__":
client = NM.Client.new(None)
devices = client.get_all_devices()
print "Real devices"
print "------------"
print("Real devices")
print("------------")
for d in devices:
if d.is_real():
print "%s (%s): %s" % (
d.get_iface(),
d.get_type_description(),
d.get_state(),
print(
"%s (%s): %s"
% (
d.get_iface(),
d.get_type_description(),
d.get_state(),
)
)
print "\nUnrealized/placeholder devices"
print "------------------------------"
print("\nUnrealized/placeholder devices")
print("------------------------------")
for d in devices:
if not d.is_real():
print "%s (%s): %s" % (
d.get_iface(),
d.get_type_description(),
d.get_state(),
print(
"%s (%s): %s"
% (
d.get_iface(),
d.get_type_description(),
d.get_state(),
)
)