Skip to main content

Mojo module

arg

Implements functions and variables for interacting with execution and system environment.

You can import these APIs from the sys package. For example:

from sys import argv
def main():
arguments = argv()
print(
arguments[0], #app.mojo
arguments[1] #Hello world!
)
for arg in arguments:
print(arg)
# If the program is app.mojo:
# mojo run app.mojo "Hello world!"
from sys import argv
def main():
arguments = argv()
print(
arguments[0], #app.mojo
arguments[1] #Hello world!
)
for arg in arguments:
print(arg)
# If the program is app.mojo:
# mojo run app.mojo "Hello world!"

Functions

  • argv: The list of command line arguments.