python - 在字符串的基础上给数组一个不同的名称
问题描述
正如您在标题中所读到的,我想在 Python 中的另一个字符串变量的基础上为数组指定一个特定名称。我是 python 新手,但我已经知道 JS
这是我的一段代码:
bot = Bot()
chosenusers = bot.read_list_from_file(args.filepath) #enderlxxvii
if not chosenusers:
exit()
else:
print("Found %d users in file." % len(chosenusers))
bot.login(username=args.u, password=args.p, proxy=args.proxy)
bot.follow_users(chosenusers)
for x in chosenusers:
followers = bot.get_user_followers(x) #Array
我希望将数组称为 enderlxxviifollowers 或类似的名称,希望您能理解我的意思。
解决方案
这种情况的一般答案是:
globals()["new_var_name"] = old_var_name
你可以从任何你想要的地方获得 new_var_name,假设那是你正在寻找的。
推荐阅读
- javascript - WKWebView - 防止用户文本选择触发的自动滚动
- r - 如何在不重复列名的情况下使用 readr::write_excel_csv 附加数据?
- javascript - jQuery中IMG URL文件夹位置的拇指旋转器
- python - 如何将文件从 django 发送到 python 脚本?
- linux - 无法获取命令输出的绝对值
- javascript - instanceof 为我的自定义异常类返回错误
- python-3.x - 从连接到串行端口的设备丢失数据
- javascript - 点击视频播放器更新图标
- python - Pcolormesh 值未映射到 matplotlib BoundaryNorm 中的正确 bin
- abap - 从 ABAP 结构中选择字段值