Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
跳过列表的元素-Python_Python - Fatal编程技术网

跳过列表的元素-Python

跳过列表的元素-Python,python,Python,我有两个用Python打开的json文件。我想做一些事情,如果一个条件不满足,我可以跳过当前元素,继续下一个。我的代码如下所示: t_a = first json file t = second json file for token in t_a if token in t #do something if token not in t #skip the current token and move on to the next one 最后一步是我的问

我有两个用Python打开的json文件。我想做一些事情,如果一个条件不满足,我可以跳过当前元素,继续下一个。我的代码如下所示:

t_a = first json file
t = second json file
for token in t_a
    if token in t
     #do something
    if token not in t
     #skip the current token and move on to the next one
最后一步是我的问题。我是python新手,不知道如何跳过当前元素,只需使用:

只需使用:

只需使用:

只需使用:


语句?您还需要将这两个文件加载到内存中。由于您是新的代码,我建议您应该在这里发布整个代码。另外,请看一下continue语句,如@thefourtheye建议的那样。因此,类似于token=test\u list.skip()continue这样的语句,只需去掉第二个
if
语句即可。语句?您还需要将这两个文件加载到内存中。由于您是新的代码,我建议您应该在这里发布整个代码。另外,请看一下continue语句,如@thefourtheye建议的那样。因此,类似于token=test\u list.skip()continue这样的语句,只需去掉第二个
if
语句即可。语句?您还需要将这两个文件加载到内存中。由于您是新的代码,我建议您应该在这里发布整个代码。另外,请看一下continue语句,如@thefourtheye建议的那样。因此,类似于token=test\u list.skip()continue这样的语句,只需去掉第二个
if
语句即可。语句?您还需要将这两个文件加载到内存中。由于您是新的代码,我建议您应该在这里发布整个代码。另外,请看一下continue语句,如@thefourtheye建议的那样。因此,类似于token=test\u list.skip()continue这样的语句,只需去掉第二个
if
语句即可。
t_a = first json file
t = second json file
for token in t_a
    if token in t:
     #do something
    else:
     #skip the current token and move on to the next one
        continue
    #do something else here