a class variable question

2006-06-28 Thread micklee74
hi i have define a class like this class A: _var1 = 0 def __init__(self): ## some initialization self.func1() def func1(): . _var1 = 1 def getvarValue(self):

automatic debugger?

2006-06-26 Thread micklee74
hi is there something like an automatic debugger module available in python? Say if i enable this auto debugger, it is able to run thru the whole python program, print variable values at each point, or print calls to functions..etc...just like the pdb module, but now it's automatic. thanks --

MSoffice metadata

2006-06-24 Thread micklee74
hi is there a module in Python to extract metadata in MS office documents thanks -- http://mail.python.org/mailman/listinfo/python-list

mapping None values to ''

2006-06-18 Thread micklee74
hi i wish to map None or None values to . eg a = None b = None c = None map( something , [i for i in [a,b,c] if i in (None,None) ]) I can't seem to find a way to put all values to . Can anyone help? thanks -- http://mail.python.org/mailman/listinfo/python-list

a string problem

2006-06-13 Thread micklee74
hi if i have a some lines like this a ) here is first string b ) here is string2 c ) here is string3 When i specify i only want to print the lines that contains string ie the first line and not the others. If i use re module, how to compile the expression to do this? I tried the re module and

Re: a string problem

2006-06-13 Thread micklee74
John Salerno wrote: [EMAIL PROTECTED] wrote: hi if i have a some lines like this a ) here is first string b ) here is string2 c ) here is string3 When i specify i only want to print the lines that contains string ie the first line and not the others. If i use re module, how

Re: a string problem

2006-06-13 Thread micklee74
John Salerno wrote: [EMAIL PROTECTED] wrote: hi if i have a some lines like this a ) here is first string b ) here is string2 c ) here is string3 When i specify i only want to print the lines that contains string ie the first line and not the others. If i use re module, how

Re: a string problem

2006-06-13 Thread micklee74
John Salerno wrote: [EMAIL PROTECTED] wrote: hi if i have a some lines like this a ) here is first string b ) here is string2 c ) here is string3 When i specify i only want to print the lines that contains string ie the first line and not the others. If i use re module, how

Re: a string problem

2006-06-13 Thread micklee74
John Salerno wrote: [EMAIL PROTECTED] wrote: just curious , if RE has the \b and it works, can we look into the source of re and see how its done for \b ? I had a look in the sre module (which re seems to import), but I couldn't find much. I'm not the best at analyzing source code,

proper way to use popen4

2006-06-13 Thread micklee74
hi i have to execute some SQL statements against a database using a SQL client i want to use the os.popen4 module can someone correct the way i use os.popen4? thanks fin = select * from some_table #sql statement client = osql server user password #sql client syntax fin, fout = os.popen4(client)

regexp questoin

2006-06-09 Thread micklee74
hi i created a script to ask user for an input that can be a pattern right now, i use re to compile that pattern pat = re.compile(r%s %(userinput) ) #userinput is passed from command line argument if the user key in a pattern , eg [-] , and my script will search some lines that contains [-]

Re: regexp questoin

2006-06-09 Thread micklee74
Fredrik Lundh wrote: [EMAIL PROTECTED] wrote: pat = re.compile(r%s %(userinput) ) #userinput is passed from command line argument that r%s % (userinput) thing is a pointless operation: the r prefix controls how backslashes in a string literal is parsed; the result is an ordinary

printing backslash

2006-06-07 Thread micklee74
hi i want to print something like this |\| first i tried it as string a = |\| it prints ok but when i put it to a list a = [|\|] it gives me '|\\|' .there are 2 back slashes...i only want one.. how can i properly escape it? I have tried [r|\|] , [r'\\'] but they do not work... thanks --

printing backslash

2006-06-07 Thread micklee74
hi how can i sucessfully print |\| in the output of a print command a = |\| print a but it gives me |\\| i tried raw strings too, but it doesn't print |\| . It prints |\\| instead eventually, i also want |\| to be inside a list: alist = [|\|, 'blah', 'blah'] . How can i put |\| inside a

Re: printing backslash

2006-06-07 Thread micklee74
Tim Chase wrote: i want to print something like this |\| first i tried it as string a = |\| it prints ok but when i put it to a list a = [|\|] it gives me '|\\|' .there are 2 back slashes...i only want one.. how can i properly escape it? I have tried [r|\|] ,

check for dictionary keys

2006-06-02 Thread micklee74
hi in my code, i use dict(a) to make to a into a dictionary , a comes from user input, so my program does not know in the first place. Then say , it becomes a = { '-A' : 'value1' , '-B' : value2 , -C : value3 , '-D' : 'value4' } somewhere next in my code, i will check for these..: 1) -A and -B

default argument values qns

2006-06-01 Thread micklee74
hi i have declared a function like this: def aFunction ( arg1 , arg2 = 0): print type(arg2) when i try to print the type of arg2, it gives me 'str' type..why is it not integer type, since i have declared it as 0 ?? thanks --

deleting texts between patterns

2006-05-12 Thread micklee74
hi say i have a text file line1 line2 line3 line4 line5 line6 abc line8 ---to be delete line9 ---to be delete line10 ---to be delete line11 ---to be delete line12 ---to be delete line13 ---to be delete xyz line15 line16 line17 line18 I wish to delete lines that are in between 'abc' and 'xyz'

find all index positions

2006-05-11 Thread micklee74
hi say i have string like this astring = 'abcd efgd 1234 fsdf gfds abcde 1234' if i want to find which postion is 1234, how can i achieve this...? i want to use index() but it only give me the first occurence. I want to know the positions of both 1234 thanks --

printing out elements in list

2006-05-08 Thread micklee74
hi i have a list with contents like this alist = ['QWER' , 'askfhs', 'REWR' ,'sfsdf' , 'FGDG', 'sdfsdgffdgfdg' ] how can i convert this list into a dictionary such that dictionary = { 'QWER':'askfhs' , 'REWR' : 'sfsdf' , 'FGDG', 'sdfsdgffdgfdg' } thanks --

Re: printing out elements in list

2006-05-08 Thread micklee74
thanks for all your replies...I will go test them out.. I was wondering what does this mean alist[1::2]? thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: printing out elements in list

2006-05-08 Thread micklee74
thanks for the detailed explaination... i know about basic lists slicing..just havn't seen one with steps yet.. thanks again...clp rocks. -- http://mail.python.org/mailman/listinfo/python-list

pythonic way to sort

2006-05-03 Thread micklee74
hi I have a file with columns delimited by '~' like this: 1SOME STRING ~ABC~12311232432D~20060401~ 2SOME STRING ~DEF~13534534543C~20060401~ 3SOME STRING ~ACD~14353453554G~20060401~ . What is the pythonic way to sort this type of structured text file?

stripping

2006-05-02 Thread micklee74
hi i have a file test.dat eg abcdefgh ijklmn -newline opqrs tuvwxyz ---newline I wish to print the contents of the file such that it appears: abcdefgh ijklmn opqrs tuvwxyz here is what i did: f = open(test.dat) while 1: line = f.readline().rstrip(\n) if

stripping blanks

2006-05-02 Thread micklee74
hi i have a file test.dat eg abcdefgh ijklmn -newline opqrs tuvwxyz ---newline I wish to print the contents of the file such that it appears: abcdefgh ijklmn opqrs tuvwxyz here is what i did: f = open(test.dat) while 1: line = f.readline().rstrip(\n) if

strip newlines and blanks

2006-05-02 Thread micklee74
hi i have a file test.dat eg abcdefgh ijklmn -newline opqrs tuvwxyz I wish to print the contents of the file such that it appears: abcdefgh ijklmn opqrs tuvwxyz here is what i did: f = open(test.dat) while 1: line = f.readline().rstrip(\n) if line == '':

blank lines representation in python

2006-05-02 Thread micklee74
hi what is the correct way to represent blank lines in python (while iterating a file) without regexp? I know one way is to use re.search((line,r'^$') to grab a blank line, but i wanna try not to use regexp... is it 1) if line == '': dosomething() (this also means EOF right? ) 2) if line is None:

Re: strip newlines and blanks

2006-05-02 Thread micklee74
thanks..and sorry, i am using the web version of google groups and didn't find an option i can edit my post, so i just removed it.. thanks again for the reply.. -- http://mail.python.org/mailman/listinfo/python-list

can anyone advise me

2006-04-27 Thread micklee74
why the output of this code : x = 0 while x 10: z = 0 print x x = x + 1 while z x: print z, z = z + 1 is 0 0 1 0 1 2 0 1 2 3 0 1 2 3 4 0 1 2 3 4 5 0 1 2 3 4 5 6 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7

Re: can anyone advise me

2006-04-27 Thread micklee74
Dan Sommers wrote: On 27 Apr 2006 02:48:46 -0700, [EMAIL PROTECTED] wrote: why the output of this code : x = 0 while x 10: z = 0 print x x = x + 1 while z x: print z, z = z + 1 is 0 Okay, that was x,

Re: python pyc or pyo files

2006-04-20 Thread micklee74
thanks! got it -- http://mail.python.org/mailman/listinfo/python-list

a subprocess qns

2006-04-20 Thread micklee74
hi i wanted to start execute a command and put it in the background. i am using Unix. Usually i start this command using something like this : /path/somecmd with the to put it to background. i looked at the subprocess module docs and came across this statement Replacing os.spawn*

python pyc or pyo files

2006-04-19 Thread micklee74
hi any good websites or articles that describes about pyc or pyo files , how they are generated and what's the difference between them and Java's bytecode?? thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: python pyc or pyo files

2006-04-19 Thread micklee74
thanks ! can i ask again... I have two scripts , A.py and B.py In B.py, i have an import statement to import A.py When i executed B.py, i saw a A.pyc in the same directory, but not B.pyc This is an expected behaviour right? why is B.pyc not generated? thanks --

any update to this?

2006-04-16 Thread micklee74
hi i was looking at this : http://www.python.org/doc/essays/comparisons.html on comparisons of python and other languages? are there any updates to this doc? or is there other reliable source for such comparison elsewhere? thanks -- http://mail.python.org/mailman/listinfo/python-list

nested functions

2006-04-14 Thread micklee74
hi just curious , if i have a code like this? def a(): def b(): print b def c(): print c how can i call c() ?? -- http://mail.python.org/mailman/listinfo/python-list