python - 调用变量时的查询函数
问题描述
我想知道在使用变量时是否可以调用函数或动作。
我有文本变量:
text = "This is My text, and I would like HERE a Smiley, but i'm not satisfied, so I want here a smiley with sunglasses, and right after HERE I would like an emoji with a heart."
现在,由于 selenium 的事实,我必须使用 javascript injection 来放置表情符号,并且由于输入仍然不存在而在初始化变量时无法完成,有没有办法调用一个函数,其中 += 是已经输入的带有 unicode 文本的文本?字符串太多,无法为每个编写函数,带有表情符号的句子太多,无法一一写下来。
我想要完成的是这样的:
text = "I would like a " + emoji('heart') + " And that was great, but here I would like a " + emoji('sunglasses') + " And a magnificient" + emoji(unicorn)
这是在字符串中每个字母写字母的函数:(其中文本是键)
for key in keys:
print(key)
其中,到达 emoji() 调用了在 innerHTML 中注入 += emoji 的函数。
我已经有了表情符号的 unicode 和所有东西,我错过了被调用一次的动态字符串函数调用,例如“我想要一个”已经被逐个字符写入,函数被调用,表情符号注入并且它继续编写细绳。
解决方案
推荐阅读
- swift - 需要关于可折叠表格视图标题的帮助
- sqlite - 在连接到 Linux/Debian 盒子的 USB 记忆棒上安装 SQLite
- android - 如何在活动之间传递书籍数组列表
- c - 在 scanf() 之后调用 printf() 不会返回任何内容
- javascript - D3-使用 d3.mouse 定位工具提示不起作用
- python - 不知道如何下载正确的库或开始使用 beautifulsoup 进行 python 网页抓取?
- javascript - jQuery kendo 网格弹出编辑器不会将下拉值传递给 .net MVC 控制器?
- java - 分配双通扫描仪不会读取第一个输入
- python - 具有列表值的字典键
- mongodb - 测试 Webflux REST API 的正确方法