我不知道什么是argv,与raw_input()有什么不同? [英] I Don't Know What is argv and what's different with raw_input()?

查看:110
本文介绍了我不知道什么是argv,与raw_input()有什么不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从努力学习Python"中学习Python

I Learn Python From "Learn Python the Hard way"

我不知道什么是argv!

I don't know what is argv !!

(请用示例和文字说明argv)

(please explain argv with Example and text)

问题2:

raw_input和&的区别是什么argv吗?

What is Different between raw_input & argv ?

推荐答案

argv代表 arg ument v alue,它表示在传递给程序时的参数它是从命令行启动的.

argv stands for argument value and it represents the arguments passed to your program when it is launched from the command line.

例如,如果您的程序名为example.py,并且您这样运行它:

For example, if your program is called example.py, and you run it like this:

$ example.py 'hello'

然后argvhello.

raw_input是一种提示用户进行某些输入的方法.基本上,它将停止程序,显示一些文本(作为提示,但这是可选的),并且仅在用户输入内容时才继续.然后,您可以存储用户输入的内容.

raw_input is a way to prompt the user for some input. Basically, it will stop the program, display some text (as a prompt, but this is optional) and only continue when the user enters something. You can then store what the user entered.

如果您具有以下条件:

username = raw_input('Please enter your name: ')
print('Your name is: {}'.format(username))

您的程序将像这样运行:

Your program will run like this:

$ example.py
Please enter your name: Burhan
Your name is: Burhan

这篇关于我不知道什么是argv,与raw_input()有什么不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆