XML-SAX parser problem

2008-03-11 Thread hitesh thakkar
Hello, Can any one help for error in following code. actually i want to map parent element with child element, but i am unable to do so. here is the code which i am trying for please do reply if iam not on right track. import xml.sax.handler class BookHandler(xml.sax.handler.ContentHandler):

Re: List to string

2007-03-19 Thread Hitesh
On Mar 19, 8:11 am, Bruno Desthuilliers wrote: > Hitesh a écrit : > > > On Mar 18, 12:28 am, "Hitesh" <[EMAIL PROTECTED]> wrote: > >> Hi, > > >> I've a list like this.. > >> str1 = ['this is a test string inside list']

Re: List to string

2007-03-17 Thread Hitesh
On Mar 18, 12:28 am, "Hitesh" <[EMAIL PROTECTED]> wrote: > Hi, > > I've a list like this.. > str1 = ['this is a test string inside list'] > > I am doing it this way. > > for s in str1: > temp_s = s > print temp_s > > Any

List to string

2007-03-17 Thread Hitesh
Hi, I've a list like this.. str1 = ['this is a test string inside list'] I am doing it this way. for s in str1: temp_s = s print temp_s Any better suggestions? Thank you, hj -- http://mail.python.org/mailman/listinfo/python-list

Re: glob.glob output

2007-03-13 Thread Hitesh
On Mar 13, 11:00 am, Bruno Desthuilliers wrote: > Hitesh a écrit : > > > On Mar 12, 4:33 pm, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > >> Hitesh a écrit : > > (snip) > > Thank you for your reply. > > From the return value I am trying

Re: glob.glob output

2007-03-13 Thread Hitesh
On Mar 12, 4:33 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Hitesh a écrit : > > > import string > > import os > > > f = open ("c:\\servername.txt", 'r') > > linelist = f.read() > > > lineLog = string.split(linelis

Re: glob.glob output

2007-03-12 Thread Hitesh
On Mar 12, 2:12 pm, "Hitesh" <[EMAIL PROTECTED]> wrote: > On Mar 12, 1:58 pm, "Hitesh" <[EMAIL PROTECTED]> wrote: > > > > > > > import string > > import os > > > f = open ("c:\\servername.txt", 'r') >

Re: glob.glob output

2007-03-12 Thread Hitesh
On Mar 12, 1:58 pm, "Hitesh" <[EMAIL PROTECTED]> wrote: > import string > import os > > f = open ("c:\\servername.txt", 'r') > linelist = f.read() > > lineLog = string.split(linelist, '\n') > lineLog = lineLog [:-1] >

glob.glob output

2007-03-12 Thread Hitesh
import string import os f = open ("c:\\servername.txt", 'r') linelist = f.read() lineLog = string.split(linelist, '\n') lineLog = lineLog [:-1] #print lineLog for l in lineLog: path1 = "" + l + "\\server*\\*\\xtRec*" glob.glob(path1) When I run above from command line python, It prin

Re: MS SQL Database connection

2007-03-05 Thread Hitesh
On Mar 5, 4:44 am, Tim Golden <[EMAIL PROTECTED]> wrote: > Hitesh wrote: > > Hi currently I am using DNS and ODBC to connect to MS SQL database. > > Is there any other non-dns way to connect? If I want to run my script > > from different server I first have to create

MS SQL Database connection

2007-03-04 Thread Hitesh
Hi currently I am using DNS and ODBC to connect to MS SQL database. Is there any other non-dns way to connect? If I want to run my script from different server I first have to create the DNS in win2k3. Thank you, hj -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
There was a typo. I corrected it. Hitesh wrote: > How about this: > > def TruncateString(s, Tindex): > return string.ljust(s,Tindex){:Tindex] > > > s = '\\serverName\\C:\\Folder Name1\\FolderName2\\example.exe -u ABC -g > > XYZ' > try: >

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
tring(s, Sindex) except: pass hj Hitesh wrote: > I post a crappy solution but I can add few more stuff to make it fail > proof. > i.e. I can search for ".exe -u" > But if someone names folder like "folder.exe u". This script could > fail. > Or if in p

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
Thanks everyone for your help. Grant Edwards wrote: > On 2006-08-16, Hitesh <[EMAIL PROTECTED]> wrote: > > > anything after .exe should be truncated (or deleted). > > That will fail if any directory names contain the string > ".exe", but if that&#

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
Here is a mediocare solution. def TruncateString(s, Tindex): return string.ljust(s,Tindex){:Tindex] s = '\\serverName\\C:\\Folder Name1\\FolderName2\\example.exe -u ABC -g XYZ' Sindex = s.find(".exe") Sindex = Tindex +4 s1 = TruncateString(s, Sindex) Hitesh wrote: &

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
anything after .exe should be truncated (or deleted). Grant Edwards wrote: > On 2006-08-16, Hitesh <[EMAIL PROTECTED]> wrote: > > > That might work but what if I get (in future) a path name where > > foldername (and in windows it is very common, someone might name a &

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
the right side: > > s='\\serverName\C:\FolderName1\FolderName2\example.exe' -u ABC -g XYZ > p=s.split(" ", 1)[0] > print p > > '\\serverName\C:\FolderName1\FolderName2\example.exe' > > Larry Bates > > Hitesh wrote: > > > > > &g

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
ight side: > > s='\\serverName\C:\FolderName1\FolderName2\example.exe' -u ABC -g XYZ > p=s.split(" ", 1)[0] > print p > > '\\serverName\C:\FolderName1\FolderName2\example.exe' > > Larry Bates > > Hitesh wrote: > > > > > > Hi, >

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
the index but don't know how to get rid any garbase after index + 4 hj Dennis Lee Bieber wrote: > On 16 Aug 2006 09:00:57 -0700, "Hitesh" <[EMAIL PROTECTED]> declaimed > the following in comp.lang.python: > > > > > Thank you Fredrik. That works for a str

Re: Documentation Question About Depricated String Functions

2006-08-16 Thread Hitesh
Thank you guys. hj Duncan Booth wrote: > Hitesh wrote: > > > In python doc -- 4.1.4 Deprecated string functions -- I read that "The > > following list of functions are also defined as methods of string and > > Unicode objects; see ``String Methods'' (sec

Documentation Question About Depricated String Functions

2006-08-16 Thread Hitesh
Hi, In python doc -- 4.1.4 Deprecated string functions -- I read that "The following list of functions are also defined as methods of string and Unicode objects; see ``String Methods'' (section 2.3.6) for more information on those. You should consider these functions as deprecated, although they

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
nks, hj Tim Williams wrote: > On 16/08/06, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > On 16 Aug 2006 09:00:57 -0700, "Hitesh" <[EMAIL PROTECTED]> declaimed > > the following in comp.lang.python: > > > > > > > > Thank you Fredrik. Th

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
the earth I can remove those paranthesis? ty hj Fredrik Lundh wrote: > "Hitesh" wrote: > > > I get path strings from a DB like: > > > > \\serverName\C:\FolderName1\FolderName2\example.exe > > > > I am writing a script that can give me access to that

Adding a char inside path string

2006-08-16 Thread Hitesh
Hi, I get path strings from a DB like: \\serverName\C:\FolderName1\FolderName2\example.exe I am writing a script that can give me access to that exe file. But problem is that string is not universal path, I need to add C$. Any idea how I can add $ char in that string. ServerName is not fixed len

Re: Getting previous file name

2006-08-08 Thread Hitesh
print file_list[-2] return file_list[-2] if __name__ == '__main__': path = r'srv12\\c$\\backup\\my_folder' create_date, prev_file = findfile(path) Thank you hj Hitesh wrote: > Hi, > > I have a small script here that goes to inside dir and sorts th

Re: Getting previous file name

2006-08-08 Thread Hitesh
John Machin wrote: > Hitesh wrote: > > Hi, > > > > I have a small script here that goes to inside dir and sorts the file > > by create date. I can return the create date but I don't know how to > > find the name of that file... > > I need file that i

Re: Getting previous file name

2006-08-08 Thread Hitesh
stuff with DB so I am going to work on ODBC connection using python.. interesting stuff. Thank you all, hj Hitesh wrote: > Hi, > > I have a small script here that goes to inside dir and sorts the file > by create date. I can return the create date but I don't know how to > find the

Getting previous file name

2006-08-07 Thread Hitesh
Hi, I have a small script here that goes to inside dir and sorts the file by create date. I can return the create date but I don't know how to find the name of that file... I need file that is not latest but was created before the last file. Any hints... I am newbiw python dude and still trying t

Re: ST_CTIME convert to yyyymmdd

2006-08-07 Thread Hitesh
All right I got it. Thank you anyway... create_date = os.stat(pathname)[ST_CTIME] print time.strftime("%Y%m%d", time.gmtime(create_date)) Hitesh wrote: > Hi, > > Any hint on converting time from ST_CTIME secs into mmdd format? > sorry for one-liner stupid question

ST_CTIME convert to yyyymmdd

2006-08-07 Thread Hitesh
Hi, Any hint on converting time from ST_CTIME secs into mmdd format? sorry for one-liner stupid question.. I couldn;t find (or rather figure out) in docs. Thank you, hj -- http://mail.python.org/mailman/listinfo/python-list

Is there any better way to approach this problem?

2006-07-19 Thread Hitesh Joshi
Hi, I am newbie python dude. I need few hints. I created a DB table with following fields UserID(PK), TimeStamp, Version, IP, Port I need to insert these info from this .log file and the log file has lines like following with some junk garbase like "attempt using client software " I need to get

Re: What am I doing wrong here

2006-04-24 Thread Hitesh Joshi
Thank you all for the quick replies. It worked! Truely appriciated. I am python novice and still learning I hope to contribute to this group someday :) Hitesh -- http://mail.python.org/mailman/listinfo/python-list

Re: What am I doing wrong here

2006-04-24 Thread Hitesh Joshi
Thank you Robert, It worked!!! Thank you so much -- http://mail.python.org/mailman/listinfo/python-list

Re: What am I doing wrong here

2006-04-24 Thread Hitesh Joshi
ok here is the deal... I figured out how to pass the variable but now messages are not popping up on the windows screen if I use this method: import os Computerlist = ['PC1', 'PC2', 'PC3', 'PC4', 'PC5'] for ComputerName in Computerlist: print ComputerName s = "net send %s" % ComputerName

What am I doing wrong here

2006-04-24 Thread Hitesh Joshi
Hi, I wanted to pass a popup mesage using windows messagin service to five PCs. If I just use following then PC1 gets the popup service message: import os os.system('net send PC1 "Message"') But if I try to create a for loop like this it doesn't work how can I pass computerName var as an a