![](/img/trans.png)
[英]How to write items in the same array on the row and for the next array skip a line and write the items on the next row in Python
[英]How to skip a row in Python MySQL
我有一张表,我想使用 Python 在 MySQL 中编辑,并且只想编辑某些行并跳过其他行。
我需要这个比这个例子更复杂,例如 object 中的时间相关变化,表从中获取数据,但这是我需要的最简单的东西。
cursor.execute("SELECT * FROM given_table")
result = cursor.fetchall()
for row in result:
whatto = "{Name}".format(Name=row['Action'])
if whatto == "Skip" :
#instruction to print row number
#instruction to skip rest of the loop
#other instructions
我如何告诉 Python 跳过一行并给我行号(或者如果我一开始就选择了行号)?
如果我写“print(row)”,它会打印我的行内容,如果我说“print(row[0])”,它会打印我第 1 列的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.