create account

RE: Upvote bot in less than 10 lines of code by discombobulated

View this thread on: hive.blogpeakd.comecency.com

Viewing a response to: @xeroc/re-discombobulated-re-xeroc-upvote-bot-in-less-than-10-lines-of-code-20160810t123419152z

· @discombobulated ·
$0.03
Just [tested this more](https://repl.it/languages/python3) and found out what the error was:

If you include the single quotes around the array, both statements return True

    stringList = '["list","of","strings"]'
    print("list" in stringList)
    True
    print ("li" in stringList)
    True

But if you remove the single quotes around the array, it functions as intended:

    stringList = ["list","of","strings"]
    print("list" in stringList)
    True
    print ("li" in stringList)
    False

Hope this helps!
👍  ,
properties (23)
authordiscombobulated
permlinkre-xeroc-re-discombobulated-re-xeroc-upvote-bot-in-less-than-10-lines-of-code-20160810t154102727z
categorysteem
json_metadata{"tags":["steem"],"links":["https://repl.it/languages/python3"]}
created2016-08-10 15:41:03
last_update2016-08-10 15:41:03
depth3
children1
last_payout2016-08-20 18:43:12
cashout_time1969-12-31 23:59:59
total_payout_value0.033 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length520
author_reputation13,090,894,039,053
root_title"Upvote bot in less than 10 lines of code"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id726,527
net_rshares66,969,783,339
author_curate_reward""
vote details (2)
@xeroc ·
$1.08
In the first case, the `stringList` is actually a simple string and is not interpreted as an array. that's why the test returns true in both cases.
👍  , , , , ,
properties (23)
authorxeroc
permlinkre-discombobulated-re-xeroc-re-discombobulated-re-xeroc-upvote-bot-in-less-than-10-lines-of-code-20160811t065811793z
categorysteem
json_metadata{"tags":["steem"]}
created2016-08-11 06:58:12
last_update2016-08-11 06:58:12
depth4
children0
last_payout2016-08-20 18:43:12
cashout_time1969-12-31 23:59:59
total_payout_value1.070 HBD
curator_payout_value0.007 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length147
author_reputation118,819,064,085,695
root_title"Upvote bot in less than 10 lines of code"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id741,182
net_rshares1,509,500,188,688
author_curate_reward""
vote details (6)