Reputation: 430
I would like to run a shell command on Colab for Swift. I have tried all the python syntax options, and none work.
I have used the following prefixes:
!
%%
%%shell
Upvotes: 0
Views: 251
Reputation: 40888
Call it via Python
import Python
let shell = Python.import("subprocess").getoutput
prefix func ! (_ command: String) {
print(shell(command))
}
!"ls -al"
Upvotes: 3