M
Modular13mo ago
RogSat

argv()

I can't seem to access argv() - any ideas what I'm doing wrong ? I'm running ubuntu/wsl2. from sys import argv let a = argv()
2 Replies
carlcaulkett
carlcaulkett13mo ago
This just worked for me...
from sys import argv

fn main():
let a = argv()
for i in range(len(a)):
print(a[i])
from sys import argv

fn main():
let a = argv()
for i in range(len(a)):
print(a[i])
Testing with mojo argv_test.mojo param1 gives the output...
argv_test.mojo
param1
argv_test.mojo
param1
Executable at [0] and params at [1] onwards...
RogSat
RogSatOP13mo ago
Perfect, thanks, I was trying to iterate 'a' like a n00b.
Want results from more Discord servers?
Add your server