Giter Club home page Giter Club logo

codeexam_rh's Introduction

Excercise instructions:

Implement a script in Python that

  1. searches one or more named input files (standard input if no files are specified, or the file name '-' is given) for lines containing a match to a regular expression pattern (given on command line as well).

  2. Assume that input is ascii, you don't need to deal with different encoding.

  3. If a line matches, print it. Please print the file name and the linenumber for every match.

  4. Script accept list optional parameters which are mutually exclusive: -u ( --underscore ) which prints '^' under the matching text -c ( --color ) which highlight matching text [1] -m ( --machine ) which generate machine readable output format: file_name:no_line:start_pos:matched_text

  5. Multiple matches on single line are allowed, without overlapping.

  6. The script should be compatible in line with PEP8 coding guidelines.

  7. Please add proper documentation and error handling.

Hint: It is recommended to use a module for parsing the command line arguments and the "re" module for matching the pattern.

Try to use OOP in order to encapsulate differences between output formats. Please put into comments what design pattern it follows.

codeexam_rh's People

Contributors

enavhidekel avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.