继承我的代码:
item = [0,1,2,3,4,5,6,7,8,9]
z = [] # list of integers
for item in z:
if item not in z:
print item
Run Code Online (Sandbox Code Playgroud)
Z包含整数列表.我想将项目与Z进行比较,并打印出与项目相比时不在Z中的数字.我可以打印Z中的elemtens,当比较不是项目时,但当我尝试使用上面的代码执行相反的操作时,没有打印.
有帮助吗?
我刚刚git merge <merging_branch_name>在应用程序中完成了一个并解决了许多冲突.
但是当我这样做时git status,我可以在消息中看到带有(新提交)的子模块列表.看起来子模块(分支/标签)版本尚未更新.
例如:
modified: plugins/myplugin.git (new commits)
Run Code Online (Sandbox Code Playgroud)
如何使用版本更新子模块(带<merging_branch_name>)
我在git bash中得到这样的结果
my_app (current_branch |MERGING),
Run Code Online (Sandbox Code Playgroud)
所以,当我这样做时git status,我得到子模块列表,如下所示
modified: plugins/plugin1.git (new commits)
modified: plugins/plugin2.git (new commits)
modified: plugins/plugin3.git (new commits)
modified: plugins/plugin4.git (new commits)
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
有什么区别
queryset.filter(Q(foo='bar') | Q(foo='baz'))
Run Code Online (Sandbox Code Playgroud)
和
queryset.filter(foo__in=['bar', 'baz'])
Run Code Online (Sandbox Code Playgroud)
我发现有时他们会产生不同的结果,我无法弄清楚为什么.
我对这些查询得到了不同的结果:
In [8]: Profile.objects.filter(image="").count()
Out[8]: 7173
In [9]: Profile.objects.filter(image=None).count()
Out[9]: 25946
In [10]: Profile.objects.filter(image__in=["", None]).count()
Out[10]: 7173
In [11]: Profile.objects.filter(Q(image="") | Q(image=None)).count()
Out[11]: 33119
Run Code Online (Sandbox Code Playgroud)
我正在使用PostgreSQL作为我的数据库引擎.
我在Mac上安装gdal如下:
brew install -v gdal
Run Code Online (Sandbox Code Playgroud)
然而,当我运行我的程序(我能够在 Linux 上成功运行)时,它给出了以下错误:
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/tesor/Desktop/test/api-server/api-server/lib/python2.7/site-packages/django/contrib/gis/admin/__init__.py", line 5, in <module>
from django.contrib.gis.admin.options import GeoModelAdmin, OSMGeoAdmin
File "/Users/tesor/Desktop/test/api-server/api-server/lib/python2.7/site-packages/django/contrib/gis/admin/options.py", line 2, in <module>
from django.contrib.gis.admin.widgets import OpenLayersWidget
File "/Users/tesor/Desktop/test/api-server/api-server/lib/python2.7/site-packages/django/contrib/gis/admin/widgets.py", line 4, in <module>
from django.contrib.gis.geos import GEOSException, GEOSGeometry
File "/Users/tesor/Desktop/test/api-server/api-server/lib/python2.7/site-packages/django/contrib/gis/geos/__init__.py", line 18, in <module>
HAS_GEOS = geos_version_info()['version'] >= '3.3.0'
File "/Users/tesor/Desktop/test/api-server/api-server/lib/python2.7/site-packages/django/contrib/gis/geos/libgeos.py", line 196, in geos_version_info
raise GEOSException('Could not parse version info string "%s"' % ver)
django.contrib.gis.geos.error.GEOSException: Could not parse …Run Code Online (Sandbox Code Playgroud)