All, I am a python newbie.
Let's say I have a filename (test.conf) as below - ---- int Apple(int, int); void Jump_OnUnload(float, int); int Jockey_Apple_cat_1KK(float, int, char, int); int Jockey_Apple_cat_look(int, float, int, int); int Jockey_Apple_cat_test_ki21es(int, int, int, int); int Jockey_Apple_cat_tarLK12OU(void, int, int, int); --- Here substring "Jockey_Apple_cat" is common from 3rd line onwards as a function name. I wish to extract ONLY that function name which has 'Jockey_Apple_cat' as a substring and ignore remaining function names. The program .py written is - ----- --- #!/usr/bin/python def foo(filename): try: one = open(filename, 'r') except: print filename, 'cannot be open.' AllLines = one.readline() for eachLine in AllLines: start = eachLine.find('Jockey_Apple_cat') if start != -1: finish = eachLine.find ('(') print eachLine[start:finish] handle.close() set_foo("test.conf") ----- I did perform debugging using pdb, it only reads all the lines. Plz help!!
-- http://mail.python.org/mailman/listinfo/python-list