TypeError 我所有的打印函数:“TypeError: 'tuple' object is not callable”

问题描述 投票:0回答:1

我刚开始使用 Python,想在 Colab 的代码上使用打印功能。但是,我所有的打印函数现在都给出了相同的错误:“TypeError:'tuple' object is not callable”。

因此我尝试了一个简单的

print("Hello")

甚至那个函数也给出了同样的错误。发生了什么?昨天一切正常。

下面还有我用来上传表格的代码。

`

#upload weather data
import pandas as pd
from google.colab import files
uploaded = files.upload()

weer = pd.read_csv("weather_netherlands.csv")

df = pd.DataFrame(weer)

`

当我打开一个新笔记本时,同样的打印功能起作用了。

python printing typeerror google-colaboratory
1个回答
0
投票

首先,如果您使用的是colab,您使用的上传文件方法将不起作用。 导入以下文件:


import numpy as np

import pandas as pd

from google.colab import drive
drive.mount("/content/gdrive")

df = pd.read_csv('/content/gdrive/My Drive/weather_netherlands.csv')

df.head()
© www.soinside.com 2019 - 2024. All rights reserved.