Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on Parsing problem in Python within the Python forums, part of the Web Development category; In a recent interview I was asked to write a small Python program to parse a file. The file had the following format: line line line START-METADATA FIELD1 FIELD2 FIELD3 ...
|
|||||||
| Python Python Programming Language - Tips, Tricks, Issues, Latest News, Python Resource and Python related topics can be discussed in this forum. |
![]() |
| LinkBack | Thread Tools | Display Modes |
|
|||
|
Parsing problem in Python
In a recent interview I was asked to write a small Python program to parse a file. The file had the following format:
line line line START-METADATA FIELD1 FIELD2 FIELD3 END-METADATA blah blah START-RESULTSET Item1|Item2|Item3|Item4... ..... ... END-RESULTSET My Job was to parse the file, print all metadata fields on one line as header and then print the result set. I had never used Python and my interviewer knew that. I guess they wanted to see how I approach the problem. So I started thinking in Perl , which I have used before, and with some help from the interviewer and some on-line help, I collected the metadata in an array using the for loop and if statements. Needless to say, I did not get the job. Unfortunately, I did not get any feed back also. So, I wanted to know how many ways there are to parse a file in Python. Since this was an interview I assumed I wouldn't get more than an hour to write the program and coming from a C/Java background I am wondering how should I have written the program. |
| Sponsored Links |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| parsing data | henri084 | Java | 2 | 06-18-2009 12:19 PM |
| what is Shell, Pearl, Python Scripting? | chennaprashanth | QTP | 0 | 03-27-2008 08:44 AM |
| Python | giribabu_vuppula | Testing Issues | 1 | 12-11-2007 11:14 AM |
| Working with XML in Python | Lokesh M | AJAX & XML | 0 | 09-03-2007 07:03 AM |
| Need Forums or PERL/PYTHON | kalayama | Suggestions & Feedback | 3 | 12-21-2006 09:14 PM |