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
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
Chris McDonough wrote:
> I didn't mean to offend your sensibilities.
Me neither :-)
Peter
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
> 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
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
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
10 matches
Mail list logo