Skip to main content

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

  1. fixed write specific line

Installation and Usage

  1. use pip install file-mod

  2. Make sure that your pip version is updated pip install --upgrade pip.

  3. Select the correct package for your environment:

  4. Import the package: import filemod

Functions in the module

  1. This is a file reader method reads file content and returns it as string

filemod.reader(filename)

  1. This file writer method writes contents to the file

filemod.writer(filename,content,method)

  1. This read_specific_line reads a specific line of the file and returns it as string

filemod.read_specific_line(filename,line)

  1. 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)

  1. This extracts the number of lines filemod.extract_numbers_from(filename)

  2. This delete a specific word from a file filemod.remove_word(filename,word)

  3. This delete a specific line from a file filemod.delete_specific_line(filename,line)

  4. 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

MIT License

Authors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

filemod-2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

filemod-2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file filemod-2.tar.gz.

File metadata

  • Download URL: filemod-2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for filemod-2.tar.gz
Algorithm Hash digest
SHA256 3438b1f06820cd84b653b89b97345d0734d74a667ac46abe2261a65008715914
MD5 1f0404ef99daa18ed1306fe8ce4b149d
BLAKE2b-256 c24a65193077f44b901ce8ed591641b4b3aba6695a26ae2812ecc3e46d1a74f8

See more details on using hashes here.

File details

Details for the file filemod-2-py3-none-any.whl.

File metadata

  • Download URL: filemod-2-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for filemod-2-py3-none-any.whl
Algorithm Hash digest
SHA256 91af30285d0f38fd5268086d7d9f6f1359cc30ceb917d86f09d79037adc7f6c0
MD5 72faa8a16f1ecc490af94663087faf80
BLAKE2b-256 9723283430061494c2151c71346ad9df2c018a76abe7a6c329482722321bb453

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page