本文整理汇总了Python中scanner.Scanner.readline方法的典型用法代码示例。如果您正苦于以下问题:Python Scanner.readline方法的具体用法?Python Scanner.readline怎么用?Python Scanner.readline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scanner.Scanner
的用法示例。
在下文中一共展示了Scanner.readline方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Scanner
# 需要导入模块: from scanner import Scanner [as 别名]
# 或者: from scanner.Scanner import readline [as 别名]
#!/usr/bin/env python3
# Test some ideas for the scanner
from scanner import Scanner
from time import sleep
s = Scanner()
print("We have our scanner:", s)
print("Writing a simple GLG command")
s.writeline('GLG')
print("Retrieving the rsponse")
print(s.readline())
print("Now send a few commands with decoded response")
print("MDL:", s.command("MDL"))
print("VER:", s.command("VER"))
print("GLG:", s.command("GLG"))
# Run a loop for a minute (more or less)
print("Looping for 5 receptions. Use ^C if it's taking too long.")
t = 0
try:
while t < 5:
r = s.command("GLG")
if r.NAME1:
print("Sys={NAME1}, Group={NAME2}, Chan={NAME3}, Sql={SQL}, Mute={MUT}, Time={TIME}".format_map(r))
t += 1