我的任务是创建一个程序来从文件中读取并检查哪些员工在一起工作时间更长。我已经创建了从文件读取并将代码存储在数组中的代码。您可以在下面进行检查:
string path;
do
{
Console.Write("Please enter the path of the file: ");
path = Console.ReadLine();
if (!File.Exists(path))
{
Console.WriteLine("The path is not correct.");
}
} while (!File.Exists(path));
string[] lines = File.ReadAllLines(path);
foreach (string line in lines) //just to check if the program can read from a file
{
Console.WriteLine(line);
}
Console.WriteLine();
for (int i = 0; i < lines.Length; i++)
{
string[] values = lines[i].ToString().Split(',');
foreach (string el in values) //just to check if the value are stored inside the array
{
Console.Write(el + " ");
}
}
Console.ReadLine();
此代码给出以下结果:
Please enter the path of the file: C:\Users\...
143, 12, 2013-11-01, 2014-01-05
145, 10, 2009/01/01, 2011/04/27
140, 10, 2009.03.01, 2011.04.27
111, 10, 2009.03.01, NULL
143 12 2013-11-01 2014-01-05
145 10 2009/01/01 2011/04/27
140 10 2009.03.01 2011.04.27
111 10 2009.03.01 NULL
(这些列分别代表:雇主ID,项目ID,DateFrom和DateTo)。现在,我需要创建一个代码来计算2名员工在同一项目上工作的时间(使用项目ID和日期来计算工作时间)。我需要一些帮助,以了解如何做到这一点。谢谢!
答案 0 :(得分:1)
这可能是一个好的开始:
.execute_async_script('googletag.pubads()')
解析为诸如from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
url = 'https://joursferies.fr'
d = DesiredCapabilities.CHROME
d['loggingPrefs'] = { 'browser':'ALL' }
browser = webdriver.Chrome(desired_capabilities=d)
browser.get(url)
browser.execute_script('googletag.openConsole()')
# Until here everything is perfect but with the following line is when I never get any answer:
browser.execute_script('googletag.pubads()')
和values
(以及int
)的数据类型。一旦有了这些对象,就可以开始编写程序逻辑。