本文整理汇总了Python中LinkedList.linkedList方法的典型用法代码示例。如果您正苦于以下问题:Python LinkedList.linkedList方法的具体用法?Python LinkedList.linkedList怎么用?Python LinkedList.linkedList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinkedList
的用法示例。
在下文中一共展示了LinkedList.linkedList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import LinkedList [as 别名]
# 或者: from LinkedList import linkedList [as 别名]
def main():
# make the nodes from the .csv file and put them into a linked list
with open('output.csv', 'r') as csvFile:
lists = LinkedList.linkedList()
for row in csvFile:
diseaseText = repr(row.strip())
lists.newNode(diseaseText)
# print the list to the console (currently prints in reverse order of addition to the list)
currentNode = lists.head
while currentNode.next != None:
print currentNode.cargo
currentNode = currentNode.next
# print only the diseases beginning with user inputted letter
hasDiseases = False
print " "
searchFor = raw_input("Enter a letter to narrow search (A-G): ")
print " "
currentNode = lists.head
while currentNode.next != None:
if currentNode.cargo[1] == searchFor:
print currentNode.cargo
hasDiseases = True
currentNode = currentNode.next
if hasDiseases == False:
print "List not extensive enough, no diseases found."
print " "