[Tutor] Referencing a string

kalike2003 at netscape.net kalike2003 at netscape.net
Sun Sep 14 14:10:28 EDT 2003


Hi,
I am having problem in using os.system(cmd) function. The function does not return the correct result when a string variable is given in the pattern field. The code is like this.
cmd = "grep -c pattern " + 'filelist3' + " > " + 'grepdata'
os.system(cmd)
Instead of looking at the contents of variable pattern, it takes pattern as the string to search and searches in the file. The contents of the variable pattern is correctly shown when I do a print.
Instaed of variable, when I tried with a fixed pattern like "the", it works fine.
Please suggest me the correct method.

Thanks.

__________________________________________________________________
McAfee VirusScan Online from the Netscape Network.
Comprehensive protection for your entire computer. Get your free trial today!
http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397

Get AOL Instant Messenger 5.1 free of charge.  Download Now!
http://aim.aol.com/aimnew/Aim/register.adp?promo=380455



More information about the Tutor mailing list