Skip to main content

My package to convert str-list and list-str.

Project description

ListTransformer

Installation

pip install ListTransformer

Examples

import ListTransformer

liste = ListTransformer.lister("123 123 123")
print(liste)
print(ListTransformer.str_list(liste))

lister

Converts strings to lists.

  • (required) str_list: str the text to convert to list
  • (optional) typ: lister.Typ the method for example comma or space, default is that it is selected automatically
    • Attributes ListTransformer.Typ.auto, ListTransformer.Typ.comma, ListTransformer.Typ.space the input format

Example

import ListTransformer

print(ListTransformer.lister("123 123 123"))
print(ListTransformer.lister("123, 123, 123"))

Outputs:

['123', '123', '123'] as list
['123', '123', '123'] as list

str_list

Convert lists to strings.

  • (required) list: list The list to be converted into a string
  • (optional) split: lister.Splits The way in which the string should separate the entries
    • Attributes ListTransformer.Splits.space, ListTransformer.Splits.comma the output format

Example

import ListTransformer

liste = ["test1", "test2", "test3"]

print(ListTransformer.str_list(liste))
print(ListTransformer.str_list(liste, ListTransformer.Splits.space))

Outputs:

test1, test2, test3 as string
test1 test2 test3 as string

difference

Shows the differences between two lists.

  • (required) list1: list The first list.
  • (required) list2: list The secend list.
    • Attributes ListTransformer.Tools.same, ListTransformer.Typ.no_same The type whether entries should occur twice.

Example

import ListTransformer

print(ListTransformer.difference([1, 2, 3], [1, 2, 3, 4, 5, 5]))
print(ListTransformer.difference([1, 2, 3], [1, 2, 3, 4, 5, 5], ListTransformer.Tools.no_same))

Outputs:

[4, 5, 5] as list [4, 5] as list

intersection

Shows the entries that are the same.

  • (required) list1: list The first list.
  • (required) list2: list The secend list.
    • Attributes ListTransformer.Tools.same, ListTransformer.Typ.no_same The type whether entries should occur twice.

Example

import ListTransformer

print(ListTransformer.intersection([1, 2, 3, 3], [1, 2, 3, 3, 4, 5]))
print(ListTransformer.intersection([1, 2, 3, 3], [1, 2, 3, 3, 4, 5], ListTransformer.Tools.no_same))

Outputs:

[1, 2, 3, 3] as list
[1, 2, 3] as list

combine

returns the two lists combined into one.

  • (required) list1: list The first list.
  • (required) list2: list The secend list.
    • Attributes ListTransformer.Tools.same, ListTransformer.Typ.no_same The type whether entries should occur twice.

Example

import ListTransformer

print(ListTransformer.combine([1, 2, 3], [4, 5, 6, 6]))

print(ListTransformer.combine([1, 2, 3], [4, 5, 6, 6], ListTransformer.Tools.no_same))

Outputs:

[1, 2, 3, 4, 5, 6, 6] as list
[1, 2, 3, 4, 5, 6] as list

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

listtransformer-0.2.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

listtransformer-0.2.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file listtransformer-0.2.0.tar.gz.

File metadata

  • Download URL: listtransformer-0.2.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.1 Windows/11

File hashes

Hashes for listtransformer-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a6c926769a28bbe10dada685471ae93252a4084f8d8414e575c6de5a3aa57417
MD5 be8ee17326f0be1aa5cacd2316a7f136
BLAKE2b-256 412dca6d02de3295a4eae0e612a02702f4e7e635c253eb9eeed5e55931929452

See more details on using hashes here.

File details

Details for the file listtransformer-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: listtransformer-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.1 Windows/11

File hashes

Hashes for listtransformer-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 068d6e8e925ba1215a5597db5277a675f0137de89d5fc460198fd3b02856aba3
MD5 11d4636a74b582c33b8bfb0ebd7815f2
BLAKE2b-256 4c1db5716838866f66c26af85b391b79e96e2a38a565e7a4b597f74eece072ec

See more details on using hashes here.

Supported by

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