当前位置: 首页>>代码示例>>Python>>正文


Python Writer.printRelation方法代码示例

本文整理汇总了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")
         
开发者ID:rubenlagus,项目名称:IMDBActors,代码行数:32,代码来源:grados_separacion.py


注:本文中的writer.Writer.printRelation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。