Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

listwalker

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

listwalker

A tool for traversing multi-dimensional lists.

  • 1.1
  • PyPI
  • Socket score

Maintainers
1

listwalker

A tool for traversing multi-dimensional lists in Python.

Installation

pip install --upgrade listwalker

Examples

from listwalker import ListWalker2D

walker2D = ListWalker2D[int]([
	[1, 2, 3, 4, 5],
	[6, 7, 8, 9, 10],
	[11, 12, 13, 14, 15],
	[16, 17, 18, 19, 20],
	[21, 22, 23, 24, 25],
	[26, 27, 28, 29, 30]
])  # The cursor is at 1

walker2D.walk_down()  # The cursor is at 6
walker2D.walk_down()  # The cursor is at 11
walker2D.walk_down()  # The cursor is at 16
walker2D.walk_right()  # The cursor is at 17

print(walker2D.cursor_element.value)  # -> 17
print(walker2D.get_neighbors())
# {
# 	'up': ListWalkerElement(12),
# 	'right': ListWalkerElement(18),
# 	'down': ListWalkerElement(22),
# 	'left': ListWalkerElement(16)
# }

walker2D.print()
# +---+----+--------+----+----+----+
# |   | 0  |   1    | 2  | 3  | 4  |
# +---+----+--------+----+----+----+
# | 0 | 1  |   2    | 3  | 4  | 5  |
# | 1 | 6  |   7    | 8  | 9  | 10 |
# | 2 | 11 |   12   | 13 | 14 | 15 |
# | 3 | 16 | > 17 < | 18 | 19 | 20 |
# | 4 | 21 |   22   | 23 | 24 | 25 |
# | 5 | 26 |   27   | 28 | 29 | 30 |
# +---+----+--------+----+----+----+

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc