本文介绍了在Google Colab中传递命令行参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Google Colab中运行python代码时如何传递命令行参数?我编写了一个代码,该文件将文件作为通过sys.argv []的输入.我该怎么做?
How to pass commandline argument when running a python code in google colab?I have written a code which takes a file as input via sys.argv[]. How do I do this?
推荐答案
据我所知,没有将命令行参数传递给python代码的特殊方法.这是创建tfrecords时使用的工作代码示例.
As far as I know, there is no special way to pass command line arguments to python code. This is a working code sample I use to when creating tfrecords.
!python generate_tfrecord.py --csv_input=data/test_labels.csv --output_path=data/test.record --image_dir=images/
我没有看到常规命令行python参数传递和colab之间有任何区别.请在您的问题中添加更多代码,以获得更好的帮助.
I don't see any difference between the regular command line python argument passing and the colab. Please add more code to your question to get better help.
这篇关于在Google Colab中传递命令行参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!