我如何对此进行编码并用pywhatkit打印消息
我正在尝试使用pywhkit自动化一些whatsapp消息,但是有一些错误:在bellow中,变量消息仅在类型为str时才打印,如果我添加.encode('utf-8),则它将更改为字节而且我不知道如何组织它,我已经考虑了很多想法,但是它行不通,您不能对串联的字符串提出重音吗?如果我只发送无变量的消息,则可以正常工作。
def send():
today = get_date()
for day in range(30):
text_today = date.today().strftime("%B %d, %Y")
print(f"Today is: {text_today}" )
if today >=6:
print("is the weekend!")
else:
not = get_article()
menssage = str(' *¡Hi, Community!* Here are 5 articles in which you can find valuable content:\n\n -' + not + '\n').encode('utf-8') #error here
print(type(mensaje))
pywhatkit.sendwhatmsg_to_group("###############", message, 17, 50, 20, True, 3)
print("message sent")
这样的工作:
message = "¡hello there!".encode(utf-8)
pywhatkit.sendwhatmsg_to_group("###############", message, 17, 50, 20, True, 3)
我可以做些什么? - 对不起,找不到标签pywhkit。
i'm trying to automate some whatsapp messages with pywhatkit, but have some errors: in the code bellow, the variable message only print when the type is str, if if I add .encode('utf-8) then it changes to bytes and I don't know how to organize it, I have given it a lot of thought but it doesn't works, can't you put an accent to concatenated strings? if I just send a message without variables it works.
def send():
today = get_date()
for day in range(30):
text_today = date.today().strftime("%B %d, %Y")
print(f"Today is: {text_today}" )
if today >=6:
print("is the weekend!")
else:
not = get_article()
menssage = str(' *¡Hi, Community!* Here are 5 articles in which you can find valuable content:\n\n -' + not + '\n').encode('utf-8') #error here
print(type(mensaje))
pywhatkit.sendwhatmsg_to_group("###############", message, 17, 50, 20, True, 3)
print("message sent")
works like this:
message = "¡hello there!".encode(utf-8)
pywhatkit.sendwhatmsg_to_group("###############", message, 17, 50, 20, True, 3)
there's something i can do? -- sorry cant find the tag pywhatkit.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论