Skip to content

damonthecricket/pyutils

Repository files navigation

PyUtils

codebeat badge Build Status

Python programming language utils library.

  1. Features
  2. Installation

Features

  1. Array. Tiny module to work with Python array.

    import pyutils.array as array
    
    full_array = [1, 2, 3, 4, 5]
    empty_array = []
    
    # Returns 5
    last = array.last(full_array)
    
    # Returns False
    is_empty = array.is_empty(full_array)
    
    # Returns True
    is_elements = array.is_elements(full_array)
    
    # Returns None
    last = array.last(empty_array)
    
    # Returns True
    is_empty = array.is_empty(empty_array)
    
    # Returns False
    is_elements = array.is_elements(empty_array)
  2. CSVUtil. Tiny module to work with csv file.

    import pyutils.csvutils as csv
    
    // Load csv
    
    path = "1.txt"
    
    // Load 1.txt csv array.
    c = csv.load(path)
    
    // Load 1.txt csv file as dictionary array.
    c = csv.load_dictionary(path)
  3. File. Tiny module to work with file.

    import pyutils.file as file
    
    path = "data/text/file.txt"
    
    // Returns file.txt
    name = file.name_from_path(path)
    
    // Returns txt
    extension = file.name_from_path(path)
  4. Folder. Tiny module to work with dictionary.

    folder /
          1.txt
          2.txt
          a /
    
    import pyutils.folder as folder
    
    // Returns ["1.txt", "2.txt", "a"]
    content = folder.content("folder/")

Installation

$ git clone https://github.com/damonthecricket/pyutils.git

Releases

No releases published

Packages

No packages published