本文整理汇总了Python中scanner.Scanner.readint方法的典型用法代码示例。如果您正苦于以下问题:Python Scanner.readint方法的具体用法?Python Scanner.readint怎么用?Python Scanner.readint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scanner.Scanner
的用法示例。
在下文中一共展示了Scanner.readint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createSearchArray
# 需要导入模块: from scanner import Scanner [as 别名]
# 或者: from scanner.Scanner import readint [as 别名]
def createSearchArray(size):
command = str.format("python3 makeintegers.py {0} 0 1 {1} > data.out", size, swaps)
# create a file called data.out with the randomized array
subprocess.call(command, shell=True)
numFile = Scanner("data.out")
searchArray = DynamicArray(size)
# create a DynamicArray with the randomized search data
while True:
token = numFile.readint()
if token == "":
break
else:
searchArray.addToBack(token)
return searchArray
示例2: input
# 需要导入模块: from scanner import Scanner [as 别名]
# 或者: from scanner.Scanner import readint [as 别名]
input()
else:
value = int(command[2:])
heap.insert(value)
elif option == "f":
filename = command[2:]
values = QueueSLL()
try:
scan = Scanner(filename)
except IOError:
print("file not found")
input()
continue
while True:
nextInt = scan.readint()
if nextInt == "":
break
if type(heap) == HeapBT:
values.enqueue(BinaryNode(nextInt))
else:
values.enqueue(nextInt)
scan.close()
heap.readData(values)
elif option == "v":
if heap.peek() == None:
print("Error: the tree is empty")
input()
else:
if type(heap) == HeapBT: