我不会在技术支持脚本中创建word-ban系统。
但我无法想象如何设计json和foreach。
安排:
"banned_words": [
{
word, word2, word3, word4
message: why we banned this words
}
{
help, mail, register, email
message: we know whats the problem, be patient
}
]
JSON设计应该如何以及我如何预测它们?
我正在使用 strpos()功能检查故障单消息。
答案 0 :(得分:0)
你所拥有的东西不是有效的JSON。 (我假设你已经知道了。)要将你拥有的东西变成有效的JSON,你需要改变一些事情。
使用print (df.groupby([pd.TimeGrouper('1Min')]).mean())
A B
2016-09-23 19:36:00 24.133333 33.888889
2016-09-23 19:37:00 24.100000 34.000000
引用所有键和字符串值。
对于"
中每个对象中的单词列表,您需要
将它们包含在数组banned_words
中并为它们分配密钥。
你应该最终得到这样的JSON:
[]
获得JSON之后,您可以循环遍历单词列表及其相应的消息,如下所示:
{"banned_words": [
{
"words": ["word", "word2", "word3", "word4"],
"message": "why we banned this words"
},
{
"words": ["help", "mail", "register", "email"],
"message": "we know whats the problem, be patient"
}
]
}
(如何从这一点实际实现禁用系统这个词超出了Stack Overflow答案的范围。)