Viewing a response to: @kona/re-deanliu-da-series-learn-python-with-steem-03-20180730t040055295z
有個問題,為什麼我在line6, 如果不打東西會顯示IndentationError,可是這樣加上print(''),好像有點多餘,求解答!
author | kona |
---|---|
permlink | re-kona-re-deanliu-da-series-learn-python-with-steem-03-20180730t040612914z |
category | da-learnpythonwithsteem |
json_metadata | {"tags":["da-learnpythonwithsteem"],"app":"steemit/0.1"} |
created | 2018-07-30 04:06:15 |
last_update | 2018-07-30 04:06:15 |
depth | 2 |
children | 10 |
last_payout | 2018-08-06 04:06:15 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 70 |
author_reputation | 39,758,138,507,499 |
root_title | "[DA series - Learn Python with Steem #03] 邏輯判斷" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 66,463,946 |
net_rshares | 0 |
對,聽高手@yjcps的!
author | antonsteemit |
---|---|
permlink | re-kona-re-kona-re-deanliu-da-series-learn-python-with-steem-03-20180730t044337044z |
category | da-learnpythonwithsteem |
json_metadata | {"community":"busy","app":"busy/2.5.3","format":"markdown","tags":["da-learnpythonwithsteem"],"users":["yjcps"],"links":["/@yjcps"],"image":[]} |
created | 2018-07-30 04:43:36 |
last_update | 2018-07-30 04:43:36 |
depth | 3 |
children | 1 |
last_payout | 2018-08-06 04:43:36 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 13 |
author_reputation | 7,534,465,964,895 |
root_title | "[DA series - Learn Python with Steem #03] 邏輯判斷" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 66,466,873 |
net_rshares | 0 |
高手都不露面的 你是幕后高手:)
author | yjcps |
---|---|
permlink | re-antonsteemit-re-kona-re-kona-re-deanliu-da-series-learn-python-with-steem-03-20180730t052343847z |
category | da-learnpythonwithsteem |
json_metadata | {"community":"busy","app":"busy/2.5.3","format":"markdown","tags":["da-learnpythonwithsteem"],"users":[],"links":[],"image":[]} |
created | 2018-07-30 05:23:42 |
last_update | 2018-07-30 05:23:42 |
depth | 4 |
children | 0 |
last_payout | 2018-08-06 05:23:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 17 |
author_reputation | 1,019,613,572,923 |
root_title | "[DA series - Learn Python with Steem #03] 邏輯判斷" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 66,470,101 |
net_rshares | 0 |
謝謝各高手,學了pass, 還想問問,沒看清題目,這樣用上elif好還是只用if..else好?
author | kona |
---|---|
permlink | re-kona-re-kona-re-deanliu-da-series-learn-python-with-steem-03-20180730t052757212z |
category | da-learnpythonwithsteem |
json_metadata | {"tags":["da-learnpythonwithsteem"],"app":"steemit/0.1"} |
created | 2018-07-30 05:27:57 |
last_update | 2018-07-30 05:28:48 |
depth | 3 |
children | 2 |
last_payout | 2018-08-06 05:27:57 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 48 |
author_reputation | 39,758,138,507,499 |
root_title | "[DA series - Learn Python with Steem #03] 邏輯判斷" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 66,470,466 |
net_rshares | 0 |
语句是死的用法是活得,一般没用到的我都保持知道有这个知识点,需要的时候再用,平时都是怎么好用怎么来!PS我也没用elif,你想都用的话写两段也可以呀,嘻嘻!可以多读读互相的代码! Posted using [Partiko Android](https://play.google.com/store/apps/details?id=io.partiko.android)
author | shine.wong |
---|---|
permlink | shine-wong-re-kona-re-kona-re-kona-re-deanliu-da-series-learn-python-with-steem-03-20180730t104523992z |
category | da-learnpythonwithsteem |
json_metadata | {"app":"partiko"} |
created | 2018-07-30 10:45:24 |
last_update | 2018-07-30 10:45:24 |
depth | 4 |
children | 1 |
last_payout | 2018-08-06 10:45:24 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 187 |
author_reputation | 1,329,335,530,903 |
root_title | "[DA series - Learn Python with Steem #03] 邏輯判斷" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 66,498,085 |
net_rshares | 0 |
謝謝
author | kona |
---|---|
permlink | re-shinewong-shine-wong-re-kona-re-kona-re-kona-re-deanliu-da-series-learn-python-with-steem-03-20180730t104803993z |
category | da-learnpythonwithsteem |
json_metadata | {"tags":["da-learnpythonwithsteem"],"app":"steemit/0.1"} |
created | 2018-07-30 10:48:06 |
last_update | 2018-07-30 10:48:06 |
depth | 5 |
children | 0 |
last_payout | 2018-08-06 10:48:06 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 2 |
author_reputation | 39,758,138,507,499 |
root_title | "[DA series - Learn Python with Steem #03] 邏輯判斷" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 66,498,312 |
net_rshares | 167,415,753 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
shine.wong | 0 | 167,415,753 | 100% |
你可以吧这个print换成pass  这样符合语法,但是你这个if里就不要写其他的了,因为我不知道pass是什么作用,只是加了后语法正常能够过编译,如果你加了其他东西,那所加的内容还是会正常运行的。
author | shine.wong |
---|---|
permlink | re-kona-re-kona-re-deanliu-da-series-learn-python-with-steem-03-20180730t044907871z |
category | da-learnpythonwithsteem |
json_metadata | {"tags":["da-learnpythonwithsteem"],"image":["https://cdn.steemitimages.com/DQmQNGcPgkeWosdePieCnKYLTwVxUjraNeUKuPt3ebiAR1d/image.png"],"app":"steemit/0.1"} |
created | 2018-07-30 04:49:09 |
last_update | 2018-07-30 04:49:09 |
depth | 3 |
children | 0 |
last_payout | 2018-08-06 04:49:09 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.032 HBD |
curator_payout_value | 0.010 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 191 |
author_reputation | 1,329,335,530,903 |
root_title | "[DA series - Learn Python with Steem #03] 邏輯判斷" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 66,467,257 |
net_rshares | 25,042,838,164 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
deanliu | 0 | 25,042,838,164 | 1% |
应该是不写东西不符合Python的语法。 在 if True: 的后面要写做出选择后要做的事情,什么都不做写个pass,像这样: ``` python if True: pass ```
author | yjcps |
---|---|
permlink | re-kona-re-kona-re-deanliu-da-series-learn-python-with-steem-03-20180730t044144827z |
category | da-learnpythonwithsteem |
json_metadata | {"community":"busy","app":"busy/2.5.3","format":"markdown","tags":["da-learnpythonwithsteem"],"users":[],"links":[],"image":[]} |
created | 2018-07-30 04:41:45 |
last_update | 2018-07-30 04:41:45 |
depth | 3 |
children | 3 |
last_payout | 2018-08-06 04:41:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.033 HBD |
curator_payout_value | 0.009 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 98 |
author_reputation | 1,019,613,572,923 |
root_title | "[DA series - Learn Python with Steem #03] 邏輯判斷" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 66,466,727 |
net_rshares | 25,198,253,471 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
deanliu | 0 | 25,042,838,164 | 1% | ||
shine.wong | 0 | 155,415,307 | 100% |
如果加了pass为什么再加其他的语句还是会被运行?pass的作用是?
author | shine.wong |
---|---|
permlink | re-yjcps-re-kona-re-kona-re-deanliu-da-series-learn-python-with-steem-03-20180730t044954337z |
category | da-learnpythonwithsteem |
json_metadata | {"tags":["da-learnpythonwithsteem"],"app":"steemit/0.1"} |
created | 2018-07-30 04:49:54 |
last_update | 2018-07-30 04:49:54 |
depth | 4 |
children | 2 |
last_payout | 2018-08-06 04:49:54 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 34 |
author_reputation | 1,329,335,530,903 |
root_title | "[DA series - Learn Python with Steem #03] 邏輯判斷" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 66,467,316 |
net_rshares | 0 |
 你是说这样的情况吗?pass不是跳过某段程序的意思 pass 是用来占位子的,为了让写的程序符合语法,就像上面那样 我知道的pass有两个作用: 一是像上面那样,什么都不做; 另一个是,还没想好程序的某个功能怎么写,写个pass占位子,以后有思路了再完善程序。
author | yjcps |
---|---|
permlink | re-shinewong-re-yjcps-re-kona-re-kona-re-deanliu-da-series-learn-python-with-steem-03-20180730t052211004z |
category | da-learnpythonwithsteem |
json_metadata | {"community":"busy","app":"busy/2.5.3","format":"markdown","tags":["da-learnpythonwithsteem"],"users":[],"links":[],"image":["https://ipfs.busy.org/ipfs/QmNYpBZS6e7hqFyZsEQcys1EbXtynDdw9AXJhgEpJAAeCr"]} |
created | 2018-07-30 05:22:12 |
last_update | 2018-07-30 05:22:12 |
depth | 5 |
children | 1 |
last_payout | 2018-08-06 05:22:12 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 218 |
author_reputation | 1,019,613,572,923 |
root_title | "[DA series - Learn Python with Steem #03] 邏輯判斷" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 66,469,964 |
net_rshares | 0 |