This repository contains a script for log parsing that reads standard input (stdin) line by line, computes metrics, and prints statistics after every 10 lines or upon keyboard interruption (CTRL + C). The script calculates the total file size and the number of lines for each HTTP status code encountered in the log entries.
- Directory: 0x03-log_parsing
- File: 0-stats.py
- Contains the implementation of the log parsing script.
- File: 0-generator.py
- A sample log generator script for testing the log parsing script.
- File: README.md
- Mandatory README file providing information about the project.
- File: 0-stats.py
- Read and parse log entries from standard input.
- Calculate and print statistics based on specified conditions.
- Handle keyboard interruptions.
- Scripts interpreted/compiled on Ubuntu 20.04 LTS using Python3 (version 3.4.3).
- PEP 8 style (version 1.7.x) should be followed.
- All files must be executable.
- The README.md file must be present at the root of the project folder.
-
Clone the repository:
git clone https://github.com/your-username/alx-interview.git cd alx-interview/0x03-log_parsing
-
Run the log generator script to produce sample log entries:
./0-generator.py | ./0-stats.py
-
Observe the output, which will display the total file size and the number of lines for each HTTP status code encountered.
-
The script will print statistics every 10 lines or upon keyboard interruption (CTRL + C).
- The sample log generator script (
0-generator.py
) generates random log entries for testing purposes. - Keyboard interruption (CTRL + C) is handled gracefully, and the script prints the final statistics before exiting.
Copyright © 2024 ALX, All rights reserved.# Pascal's Triangle
This repository contains a Python script for generating Pascal's Triangle. The script implements a function that returns Pascal's Triangle up to a given number of rows.
- Run
0-main.py
to test thepascal_triangle()
function and view the generated Pascal's Triangle.