Re: breadth first search

2006-02-08 Thread Charles Krug
On 2006-02-08, News <[EMAIL PROTECTED]> wrote: > I am new in using Python > > Anyone know how to implement breadth first search using Python? Can Python > create list dynamically, I want to implement a program which will read data > from a file and store each line into a l

Re: breadth first search

2006-02-08 Thread Tim Chase
in this dictionary specify which nodes can be reached from the current location, and the values of the dictionary represent the weight/cost associated with traversing to this node. You can then do a breadth-first search of this data structure just as you would in any other language. It doesn&#

Re: breadth first search

2006-02-08 Thread Peter Otten
Chris McDonough wrote: > I didn't mean to offend your sensibilities. Me neither :-) Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: breadth first search

2006-02-08 Thread Chris McDonough
Peter Otten wrote: > Chris McDonough wrote: > >>> Can Python >>> create list dynamically, I want to implement a program which will read >>> data from a file and store each line into a list, is this possible? >> L = [] >> [L.append(line) for line in (open('filename.txt')] > > Why would you create

Re: breadth first search

2006-02-08 Thread Scott David Daniels
Chris McDonough wrote: > News wrote: >... Can Python >> create list dynamically, I want to implement a program which will read >> data >> from a file and store each line into a list, is this possible? > > L = [] > [L.append(line) for line in (open('filename.txt')] > > - C Woops, crossed wires

Re: breadth first search

2006-02-08 Thread mrmakent
Chris McDonough wrote: > L = [] > [L.append(line) for line in (open('filename.txt')] Ouch. Did you perhaps mean: L = [ line for line in open('filename.txt') ] Or, with better error handling: try: f = open('filename.txt') except IOError: # handle error here else: L = [ line for lin

Re: breadth first search

2006-02-08 Thread Peter Otten
Chris McDonough wrote: >> Can Python >> create list dynamically, I want to implement a program which will read >> data from a file and store each line into a list, is this possible? > > L = [] > [L.append(line) for line in (open('filename.txt')] Why would you create two lists, one filled only wi

Re: breadth first search

2006-02-08 Thread Tim Chase
> Anyone know how to implement breadth first search using Python? Yes. Granted, for more details, you'd have to describe the data structure you're trying to navigate breadth-first. > Can Python create list dynamically Is Perl write-only? Does Lisp use too many parens? Of

Re: breadth first search

2006-02-08 Thread Chris McDonough
News wrote: > I am new in using Python > > Anyone know how to implement breadth first search using Python? Breadth-first search of what? It depends what kind of tree you're searching, but here's a page with a few implementations: http://aspn.activestate.com/ASPN/Cookbook/P

breadth first search

2006-02-08 Thread News
I am new in using Python Anyone know how to implement breadth first search using Python? Can Python create list dynamically, I want to implement a program which will read data from a file and store each line into a list, is this possible? Please send mail to me at [EMAIL PROTECTED] or reply