Skip to content

Wartori54/gopylists

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

gopylists

A module for go that adds multiple type arrays.

How to use

package main

import (
  "fmt"
  "github.com/Wartori54/gopylists"
 )

func main() {
  //create a new blank list
  list := gopylists.NewPyList()
  
  //create a new list from arguments
  listfromarguments := gopylists.NewPyListFromArgs(1.0, "text", complex(1,2))
  
  //print the list
  fmt.Println(listfromarguments)
  
  //append to the list
  listfromarguments.Append(89)
  
  //or insert
  listfromarguments.Insert(-5, 2)
  
  //getting an element
  fmt.Println(listfromarguments.Get(1))
  
  //concatenate two lists
  list.Append("abc")
  listfromarguments.Concatenate(list)
  
  //get how many times appear an element
  listfromagruments.Count("text") // 1
  
  //and the "in" operator from python
  fmt.Println(gopylists.In([]int{1, 2, 3, 4}, 3) // true
}

About

A module for go that adds multiple type arrays

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages