我在mongo shell中运行以下查询:
db.Profiles.find ( { $or: [ {"name": "gary"}, {"name": "rob"} ] } )
Run Code Online (Sandbox Code Playgroud)
它只是没有按预期返回(JSON)?
在Python 3.2/Windows环境中处理单词出现计数应用程序.
任何人都可以请帮助告诉我为什么以下不起作用?
from string import punctuation
from operator import itemgetter
N = 100
words = {}
words_gen = (word.strip(punctuation).lower() for line in open("poi_run.txt")
for word in line.split())
for word in words_gen:
words[word] = words.get(word, 0) + 1
top_words = (words.iteritems(), key=itemgetter(1), reverse=True)[:N]
for word, frequency in top_words:
print ("%s %d") % (word, frequency)
Run Code Online (Sandbox Code Playgroud)
追溯错误是:
Message File Name Line Position
Traceback
<module> C:\Users\will\Desktop\word_count.py 13
AttributeError: 'dict' object has no attribute 'iteritems'
Run Code Online (Sandbox Code Playgroud)
谢谢
NB
完全工作的代码:
from string import punctuation
from operator …Run Code Online (Sandbox Code Playgroud) 在我的SQL Server 2008 R2 Express版本上创建数据库时遇到了实际问题.
我已经按照下面的链接但没有提供信息.
在此先感谢您的帮助.
标题:Microsoft SQL Server Management Studio
数据库'test'创建失败.
(Microsoft.SqlServer.Smo)如需帮助,请单击:http: //go.microsoft.com/fwlink?ProdName = Microsoft + SQL + Server&ProdVer = 10.50.1600.1+((KJ_RTM).100402-1539 +)&EvtSrc = Microsoft.SqlServer.Management.Smo.ExceptionTemplates .FailedOperationExceptionText&EvtID =创建+数据库与LINKID = 20476
附加信息:
执行Transact-SQL语句或批处理时发生异常.(Microsoft.SqlServer.ConnectionInfo)
文件"D:\ DATA\test.mdf"的目录查找失败,出现操作系统错误2(无法检索此错误的文本.原因:15100).CREATE DATABASE失败.无法创建列出的某些文件名.检查相关错误.(Microsoft SQL Server,错误:5133)
如需帮助,请单击:http: //go.microsoft.com/fwlink?ProdName = Microsoft + SQL + Server&PrinterVer = 10.50.1600&EvtSrc = MSSQLServer&EvidID = 5133&LinkId = 20476
我正在与mongodb和Regex合作.
所以,我跑了:
{
"email": /@/
}
Run Code Online (Sandbox Code Playgroud)
现在我想说:
{
"email": does not contain @
}
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激
我有一个名为Profiles的集合,其中包含一个名为emails的数组.
我想将数组中的所有电子邮件字符串更改为小写.
db.Profiles.update({"emails":/@/i}, {$set: {"emails" : emails.toLowerCase()}}})
Run Code Online (Sandbox Code Playgroud)
错误:
Tue Jan 29 16:52:28 SyntaxError:missing)在参数列表(shell)之后:1
我也发现了这个:
db.Profiles.find().forEach(
function(e) {
e.emails = e.emails.toLowerCase();
db.Profiles.save(e);
}
)
Run Code Online (Sandbox Code Playgroud)
错误:
Tue Jan 29 16:51:41 TypeError:e.emails.toLowerCase不是函数(shell):3
在此先感谢您的帮助.