Dim fso, f1, ts, s Const ForReading = 1 Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.OpenTextFile("e:\serverlist.txt", ForReading)'ts.skipline '跳过一行do until ts.AtEndOfStream '判断是否到文件末尾 tsline = ts.readline'tslines
From_Ip='192.138.60.16'@echo offfor /f "tokens=1,2 delims='" %%a in (D:\ETL\bat\config.txt) do (if "%%a"=="From_Ip=" set From_Ip=%%b)echo %From_Ip% 结果:192.138.60.16 From_Ip=192.138.60.16@echo offfor /f "tokens=1,2 del
s = [] f = open('querylist.txt','r') #由于我使用的pycharm已经设置完了路径,因此我直接写了文件名 for lines in f: ls = lines.strip('\n').replace(' ','').replace('.','/').replace('?','').split('/') for i in ls: s.append(i) f.close() print(s) ===================
如下图,名称为1.txt的文本文件内有链接若干条,预期是循环读取txt文本内链接,而后访问该链接 脚本如下: for line in open('C:\\Users\\Beckham\\Desktop\\python\\1.txt'):#循环读取百度地址和提取码 address = line[0:47]#分离出百度盘地址 code = line[47:51]#分割出提取码 browser.get(address)#打开链接 browser.find_element_by_id("swidZRxd