小编sou*_*gya的帖子

我如何使用 python-redis 检查 redis 数据库中是否存在值

这是我的Python代码:

def check(request):
    import redis
    R = redis.StrictRedis(host='127.0.0.1', port=6379, db=0)
    R.set("name","srk")
    r = R.HSET("name","srk")
    print(r)
Run Code Online (Sandbox Code Playgroud)

它遇到错误并显示以下错误消息:

Internal Server Error: /get_user/
Traceback (most recent call last):
  File "/home/soubhagya/.local/share/virtualenvs/pipenv-r-zifbiy/lib/python3.5/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/home/soubhagya/.local/share/virtualenvs/pipenv-r-zifbiy/lib/python3.5/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/soubhagya/.local/share/virtualenvs/pipenv-r-zifbiy/lib/python3.5/site-packages/django/core/handlers/base.py", line 124, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/soubhagya/Desktop/Dev/rango/backend/access/views.py", line 103, in get_user
    r = R.HSET("name","srk")
AttributeError: 'StrictRedis' object has no attribute 'HSET'
Run Code Online (Sandbox Code Playgroud)

在 py-redis 中,如何检查 redis 数据库中是否存在某个值。原始查询会很有帮助。请查看我的代码。

python redis

3
推荐指数
1
解决办法
8086
查看次数

如何在用户访问页面时自动单击按钮

import React from "react";

checkClick = () => {
  console.log("clicked");
};

class Test extends React.Component {
  render() {
    return (
      <div>
        <button id="button" onClick={this.checkClick}>
          click
        </button>
      </div>
    );
  }
}

export default Test;
Run Code Online (Sandbox Code Playgroud)

如何在用户访问页面时自动点击按钮?

这里我想自动点击上面的按钮。

我尝试过:

document.getElementById("button").click()

这是行不通的。

button buttonclick reactjs

2
推荐指数
1
解决办法
2万
查看次数

fusioncharts 反应错误加载块失败

import FusionCharts from "fusioncharts";
import charts from "fusioncharts/fusioncharts.charts";
import ReactFusioncharts from "react-fusioncharts";
import React from 'react';


// Resolves charts dependancy
charts(FusionCharts);

const dataSource = {
  chart: {
    caption: "Amazon Prime Video Categorization",
    theme: "fusion",
    viewmode: "1",
    showrestorebtn: "0",
    valuefontcolor: "#FFFFFF",
    yaxismaxvalue: "1000",
    yaxisminvalue: "0",
    divlinealpha: "0"
  },
  dataset: [
    {
      data: [
        {
          id: "01",
          label: "Home",
          x: "50",
          y: "900",
          shape: "rectangle",
          width: "80",
          height: "40"
        },
        {
          id: "02",
          label: "TV Shows",
          x: "20",
          y: "500",
          shape: "rectangle", …
Run Code Online (Sandbox Code Playgroud)

fusioncharts reactjs

2
推荐指数
1
解决办法
2785
查看次数

拆分并展平字符串列表

lst = [
  "Zambia",
  "Zimbabwe",
  "Suite,203,2880,Zanker,Rd,San,Jose,95134",
  "1496A,1st,and,2nd,Floor,19th,main,8th,crossSector,1,HSR,Layout,Bengaluru,560102",
]
Run Code Online (Sandbox Code Playgroud)

在这里,我有一个世界.有些是实际的话只是一个示例("赞"),有些是喜欢的句子只是例子("组曲,203,2880,Zanker,路,三,圣何塞,95134")

我怎样才能将它们转换成以下格式.

lst = [
  "Zambia",
  "Zimbabwe",
  "Suite",
  "203",
  "2880",
  "Zanker",
  "Rd",
  "San",
  "Jose",
  "95134,
  "1496A",
  "1st",
  "and",
  "2nd",
  "Floor",
  "19th",
  "main",
  "8th",
  "crossSector",
  "1",
  "HSR",
  "Layout",
  "Bengaluru",
  "560102",
  "g2crowd_badge2",
  "Created with Sketch."
]
Run Code Online (Sandbox Code Playgroud)

如何使用python将列表转换为此格式

请看看这个.

python list

-1
推荐指数
2
解决办法
137
查看次数

标签 统计

python ×2

reactjs ×2

button ×1

buttonclick ×1

fusioncharts ×1

list ×1

redis ×1