本文整理汇总了Python中writer.Writer.printRelation方法的典型用法代码示例。如果您正苦于以下问题:Python Writer.printRelation方法的具体用法?Python Writer.printRelation怎么用?Python Writer.printRelation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类writer.Writer
的用法示例。
在下文中一共展示了Writer.printRelation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: from writer import Writer [as 别名]
# 或者: from writer.Writer import printRelation [as 别名]
print(("Please write the name of two actors/actresses (Only full names supported)"
+ " to see if they are related , write 0 to exit:"))
option = str(input('Enter the actor/actress name: '))
if option != "" or option != "0":
option2 = str(input('Enter the actor/actress name: '))
if option2 != "" or option2 != "0":
db = FileHandler()
db.openActDB()
db.openFilmsDB()
try:
option3 = int(input('Enter maximum length of path to follow, the higher number, the longer it takes (minimum 3, default 11):'))
except:
option3 = 11
if option3 < 3:
option3 = 3
shortestPath = ShortestPath(db, limit=option3)
result = shortestPath.findPath(origin=option, destiny=option2)
if result is None:
print("One of the actor/actress names doesn't exists.")
elif type(result) is int and result == -1:
print("No relation found within " + option3 + " steps")
elif type(result) is Node:
writer = Writer()
writer.printRelation(actor1=option, actor2=option2, relation=result)
db.closeActDB()
db.closeFilmsDB()
else:
print("Exiting")
else:
print("Exiting")