Task task1 = {1, 10, 13, 24, 15, 10, 0, 0, 0}; Task task2 = {2, 15, 3, 15, 25, 20, 0, 0, 0}; Task task3 = {3, 8, 15, 5, 27, 30, 0, 0, 0}; Task task4 = {4, 14, 3, 2, 19, 40, 0, 0, 0}; Task task5 = {5, 3, 20, 12, 9, 50, 0, 0, 0}; Task task6 = {6, 4, 16, 5, 29, 60, 0, 0, 0}; Task task7 = {7, 16, 13, 4, 26, 70, 0, 0, 0}; Task task8 = {8, 13, 17, 24, 5, 80, 0, 0, 0}; Task task9 = {9, 15, 3, 15, 25, 90, 0, 0, 0}; Task task10 = {10, 8, 14, 5, 27, 100, 0, 0, 0}; Task task11 = {11, 14, 3, 2, 19, 110, 0, 0, 0}; Task task12 = {12, 23, 20, 1, 9, 120, 0, 0, 0}; Task task13 = {13, 5 , 16, 8, 21, 130, 0, 0, 0}; Task task14 = {14, 12, 20, 16, 12, 140, 0, 0, 0}; Task task15 = {15, 16, 22, 7, 11, 150, 0, 0, 0};,修改爲可以通過excel文件導入
时间: 2023-09-10 19:13:39 浏览: 97
NLPCC2014task1和task2数据集资源.zip
您可以将这些任务信息保存为一个CSV文件,然后在程序中使用任何一种CSV文件读取库来读取它。以下是一个示例代码,使用Python的pandas库来读取CSV文件:
```python
import pandas as pd
df = pd.read_csv('tasks.csv', header=None)
tasks = []
for index, row in df.iterrows():
task = Task(row[0], row[1], row[2], row[3], row[4], row[5], 0, 0, 0)
tasks.append(task)
```
请注意,这里假设您的CSV文件中没有标题行,因此使用`header=None`参数来告诉pandas不要将第一行作为标题行。如果您的文件有标题行,请将该参数删除或设置为适当的值。
阅读全文