File operation lib
Project description
File Mod
File mod is easy to perform file operations with the help of good method names
and less arguments to pass
Bug fix
- readme typo fix
Installation and Usage
-
use
pip install file-mod
-
Make sure that your
pip
version is updatedpip install --upgrade pip
. -
Select the correct package for your environment:
-
Import the package:
import filemod
Functions in the module
- This is a file reader method reads file content and returns it as string
filemod.reader(filename)
- This file writer method writes contents to the file
filemod.writer(filename,content,method)
- This read_specific_line reads a specific line of the file and returns it as string
filemod.read_specific_line(filename,line)
- This extract_numbers_from reads a numbers from the file and returns all the collection of numbers in a list
filemod.read_specific_line(filename,line)
-
This extracts the number of lines
filemod.extract_numbers_from(filename)
-
This delete a specific word from a file
filemod.remove_word(filename,word)
-
This delete a specific line from a file
filemod.delete_specific_line(filename,line)
-
This write a specific line from a file
filemod.write_specific_line(filename,line)
Run Locally
Clone the project
git clone https://github.com/kshitij1235/filemod/tree/main/dist
Install
pip install filemod
List of Functions
| function name | Description| args |
| -------------------|------------|------------|
| Reader |Reads file | filename |
| writer |writes content to file|filename,content,method|
| read_specific_line |read_specific_line |filename,line|
|extract_numbers_from|extracts number form file|filename|
|remove_word |removes a specific word|filename,word|
|number_of_line |Get the number of lines in a file |filename|
|delete_specific_line|Delete a specific line |filename,line|
|write_specific_line |write a specific line |filename,line,content|
Usage/Examples
read file
import filemod
filemod.reader('demo_file.txt')
write file
import filemod
filemod.writer('demo_file.txt',content="new line ", method='w')
read_specific_line
import filemod
filemod.read_specific_line("demo_file.txt",1)
extract_numbers_from a file
import filemod
filemod.extract_numbers_from("demo_file.txt")
remove_word for a file
import filemod
filemod.remove_word("demo_file.txt","hello")
number_of_line
import filemod
filemod.number_of_line("demo_file.txt")
delete_specific_line
import filemod
filemod.delete_specific_line("demo_file.txt",1)
write_specific_line
import filemod
data="this is text"
filemod.write_specific_line("demo_file.txt",1,data)
Badges
Authors
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.