我有点问题。我对python还很新。所以dict对我来说很新鲜。我知道在我去的时候解决问题,并希望从我的错误中吸取教训。
因此错误在第一个文本变量中的'shortURL'下面。只是想知道这个问题意味着什么以及如何解决它?我已经在网上看了一下并且没有完全理解为什么在查看字符串时会遇到很多问题,但bit.ly_api只返回一个URL。
感谢您的帮助:)
print("")
print("Welcome to Sole Retriever Tweet Formulator b0.1")
type = (raw_input('What kind of tweet would you like to do?' + '\n' + '1. Store URL + Website Site' + '\n' + '2.Website URL Only' + '\n'))
if type == ('1'):
store1 = (raw_input('What is the store name hosting the Off-White x Converse Raffle? '))
storeURL = (raw_input('What is the direct URL to the raffle? '))
shortURL = b.shorten(storeURL)
text = ('Woof! ' + store1 + ' raffle is now live for the Off-White x Converse Chuck Taylor!' + '\n' + '\n' + shortURL + '\n' + '\n' + 'For raffle details and where to enter check and filter by "live" -' + '\n' + '\n' + 'https://www.soleretriever.com/off-white-x-converse-chuck-taylor/' + '\n' + '\n' + '#soleretriever #offwhite #converse #sneakers')
print (text)
os.system("echo '%s' | pbcopy" % text)
print ('\n')
print ('Copied to Clipboard')
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
twitter.update_status(status=text)
if type == ('2'):
store = (raw_input('What is the store name hosting the Off-White x Converse Raffle? '))
text = ('Woof! ' + store + ' raffle is now live for the Off-White x Converse Chuck Taylor!' + '\n' + '\n' + 'For raffle details and where to enter check and filter by "live" -' + '\n' + '\n' + 'https://www.soleretriever.com/off-white-x-converse-chuck-taylor/' + '\n' + '\n' + '#soleretriever #offwhite #converse #sneakers')
print (text)
os.system("echo '%s' | pbcopy" % text)
print ('\n')
print ('Copied to Clipboard')
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
twitter.update_status(status=text)
答案 0 :(得分:1)
对<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form class="column-form comment-form" id="{{_id}}">
<div class="">
<div class="col-12-10 col-medium-12-12 comment-content">
<input placeholder="Add a comment" type="text" value="" id="comment-{{_id}}" name="">
</div>
<div class="col-12-2 col-medium-12-12 flex comment-submit">
<input value="Submit" type="submit" />
</div>
</div>
</form>
的调用将返回带有键/值对的b.shorten(storeURL)
,包括dict
。当你在url
中连接一个字符串和dict时,Python会抛出该错误。我建议像:
print()