Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- # Filename: pml2txt.py
- # Version: 1.0.0
- # Author: Jeoi Reqi
- """
- This script converts a Process Monitor Log (PML) file (.pml) to a text file (.txt). It reads the content of the .pml file and writes it to a .txt file.
- Usage:
- - Ensure Python 3.x is installed on your system.
- - Save the pml2txt.py script to a directory of your choice.
- - Open a terminal or command prompt.
- - Navigate to the directory where the pml2txt.py script is saved.
- - Run the script using the following command: 'python pml2txt.py'
- - After successful execution, a .txt file with the same name as the input .pml file will be created in the same directory.
- Requirements:
- - Python 3.x
- """
- import os
- def convert_pml_to_txt(pml_file):
- """
- Converts a Process Monitor Log (PML) file (.pml) to a text file (.txt).
- Args:
- - pml_file (str): Path to the input .pml file.
- Returns:
- - None
- """
- # Define the output file path
- txt_file = os.path.splitext(pml_file)[0] + '.txt'
- # Read the content of the .pml file using 'latin1' encoding
- with open(pml_file, 'r', encoding='latin1') as pml:
- pml_content = pml.read()
- # Write the content to a .txt file
- with open(txt_file, 'w', encoding='utf-8') as txt:
- txt.write(pml_content)
- # Example usage: Convert 'demo.pml' to .txt
- convert_pml_to_txt('demo.pml') # Replace 'demo' with your filename.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement