Skip to content

A Python method that reads a text file "numbers.txt" that contains 20 integers. Then, it separates odd and even into two separate file with name odd.txt and even.txt, respectively. See the demo at:

Notifications You must be signed in to change notification settings

Irish-C/number-txt-file-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

number-txt-file-parser

A Python script that reads a text file named numbers.txt that contains 20 integers. The program will create two other text file; the first text file will be named even.txt that will contains all even numbers extracted from the numbers.txt. The second text file will be named odd.txt that will contains all odd numbers extracted from the numbers.txt.

Installation

To run the program, you'll need to have Python 3 installed on your computer.

Note: This program works only for windows os.


I used VS Code to create and run the program.

Dependencies

The script requires the following Python packages:

  • PySimpleGUI
  • pyperclip

pip install PySimpleGUI pyperclip

How the code works

  1. Clone the repository or download the number_parser.py and number.txt files.
  2. Open a terminal and navigate to the directory containing the script: cd /path/to/directory
  3. Run the script using python: python number_parser.py
  4. When prompted, use the "Browse" button to select the file to process.
  5. To sort the odd and even integers in the file, click the "Process File" button.
  6. While the script is processing the file, a loading bar will show.
  7. When the processing is finished, the even and odd numbers will be shown in separate text boxes. By pressing the "Save File" option, you can save them as independent text files. However, if you click "OK" the file
  8. Click the "Copy Even" or "Copy Odd" buttons to transfer the contents of the even or odd text boxes to the clipboard.
  9. Click the "Exit" button or close the window to exit the script.

About

A Python method that reads a text file "numbers.txt" that contains 20 integers. Then, it separates odd and even into two separate file with name odd.txt and even.txt, respectively. See the demo at:

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages