我在窗口 10 上使用带有 Visual Studio Code 的 python 3.6。我正在使用 API 从 SmartSheet 中提取数据。这是我的代码。
import smartsheet
import importlib
import supporting_tools as spt
Token = 'api_token'
sheet_id_2nd = 'sheet_id'
sheet_id_3rd = 'sheet_id'
sheet2nd = spt.read_sheet (Token, sheet_id_2nd)
sheet3rd = spt.read_sheet (Token, sheet_id_3rd)
col_map_2nd = spt.col_list (sheet2nd)
col_map_3rd = spt.col_list (sheet3rd)
print(col_map_2nd)
id_set_2nd = set()
id_set_3rd = set()
for row in sheet2nd.rows:
Id_cell = spt.get_cell_by_column_name(row, "Row ID", col_map_2nd)
id_set_2nd.add(Id_cell.display_value)
print(id_set_2nd)
for row in sheet3rd.rows:
Id_cell = spt.get_cell_by_column_name(row, "Row ID", col_map_3rd)
id_set_3rd.add(Id_cell.display_value)
print(id_set_3rd)
当我在调试模式下运行它时它工作正常,但当我在终端中运行它时返回此错误。我搜索了一个解决方案,似乎 iPython 有问题,但我不确定。有什么建议吗?
"C:/Users/Jay Choi/AppData/Local/Programs/Python/Python36/python.exe" "c:/Users/Jay Choi/Desktop/New folder/main.py"
File "<stdin>", line 1
"C:/Users/Jay Choi/AppData/Local/Programs/Python/Python36/python.exe" "C:/Users/Jay Choi/Desktop/New folder/main.py"
^
SyntaxError: invalid syntax