如何使用utf8字符作为对象的键

时间:2019-01-28 19:22:15

标签: python

这就是我想要的:

<!DOCTYPE html>
<html lang="en-gb">
  <head>
    <title>YouTube Embed</title>
  </head>

  <body>
    <iframe src="https://www.youtube.com/embed/kqEfk801E94" />
  </body>
</html>

<template> <div> <iframe :src="url" /> </div> </template> <script> export default { data() { return { url: '' } }, methods: { async loadYouTubeUrl() { const response = await fetch('api/videos/:id/get') // wherever your API is const json = await response.json() this.url = json.url // wherever this property is } } } </script> data = {} a = 'имя' b = 'фамилия' data[a] = 'osman' data[b] = 'omar' 不起作用。如何获得这样的结果?

1 个答案:

答案 0 :(得分:2)

如果使用Python2,请将此行放在.py文件的顶部:

# -*- coding: utf-8 -*-

如果您使用的是Python3,您的代码就可以正常工作。