Needing a WinXP Python variant of a line of code

2006-01-30 Thread Ron Rogers Jr.
I have this line of code that's written with Linux in mind: path_to_nethack_logfile = os.popen("locate logfile | grep nethackdir").read() and I'm wanting a Windows equivalent, any suestions? Thanks. CronoCloud (Ron Rogers Jr.) -- http://mail.python.org/mailman/listinfo/python-list

RE: Needing a WinXP Python variant of a line of code

2006-01-30 Thread Tim Golden
[Ron Rogers Jr.] | I have this line of code that's written with Linux in mind: | | path_to_nethack_logfile = os.popen("locate logfile | grep | nethackdir").read() | | and I'm wanting a Windows equivalent, any suestions? Well, you could obviously use os.walk to write something (cross-platf

Re: Needing a WinXP Python variant of a line of code

2006-01-30 Thread John Zenger
import os, os.path path_to_nethack_logfile = "" for root, dirs, files in os.walk("c:\\"): if 'nethackdir' in root: logs = [x for x in files if 'logfile' in x] if len(logs) > 0: path_to_nethack_logfile = os.path.join(root, logs[0]) exit Ron Rogers J

Re: Needing a WinXP Python variant of a line of code

2006-01-30 Thread Ron Rogers Jr.
Tim Golden wrote: > [Ron Rogers Jr.] > > | I have this line of code that's written with Linux in mind: > | > | path_to_nethack_logfile = os.popen("locate logfile | grep > | nethackdir").read() > | > | and I'm wanting a Windows equivalent, any suestions? > > Well, you could obviously use os

Re: Needing a WinXP Python variant of a line of code

2006-01-30 Thread Ron Rogers Jr.
John Zenger wrote: > import os, os.path > > path_to_nethack_logfile = "" > for root, dirs, files in os.walk("c:\\"): > if 'nethackdir' in root: > logs = [x for x in files if 'logfile' in x] > if len(logs) > 0: > path_to_nethack_logfile = os.path.join(root, logs[0])