第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

刪除CSV中的空白行

刪除CSV中的空白行

躍然一笑 2021-04-02 14:11:37
我正在從站點(diǎn)抓取數(shù)據(jù),并使用站點(diǎn)數(shù)據(jù)生成一個(gè)csv文件。我正在將opencsv jar和硒jar文件一起用于我的程序。CSV文件正在生成,但是在每一行之后,都會(huì)生成一個(gè)空白行。我試圖消除相同但不能消除。這是我的代碼:-package automation;import java.io.BufferedWriter;import java.io.File;import java.io.FileWriter;import java.io.IOException;import java.util.List;import org.openqa.selenium.By;import org.openqa.selenium.WebDriver;import org.openqa.selenium.WebElement;import org.openqa.selenium.chrome.ChromeDriver;import com.opencsv.CSVWriter;import com.opencsv.exceptions.CsvException;import com.opencsv.exceptions.CsvRequiredFieldEmptyException;import java.time.ZonedDateTime;public class RecruitmeentTestApp {    public static void main(String[] args) throws IOException, CsvException, CsvRequiredFieldEmptyException {           //WebDriver driver = new FirefoxDriver();        //Fetching Remote Control driver for Chrome browser           WebDriver driver = new ChromeDriver();           driver.get("https://www.premierleague.com/tables/");           driver.manage().window().maximize();           //Setting the file name in milliseconds of execution as per requirement           long miliSec=ZonedDateTime.now().toInstant().toEpochMilli();           File file = new File(miliSec+ ".csv") ;           WebElement table=driver.findElement(By.xpath("//table"));           List<WebElement> rowsList = table.findElements(By.tagName("tr"));           //List<WebElement> headerList=rowsList.get(0).findElements(By.xpath(".//th"));           List<WebElement> columnsList = null;           BufferedWriter writer = new BufferedWriter(new FileWriter(file));           CSVWriter csvWriter = new CSVWriter(writer,                                CSVWriter.DEFAULT_SEPARATOR,                                CSVWriter.NO_QUOTE_CHARACTER,                                CSVWriter.DEFAULT_ESCAPE_CHARACTER,                                CSVWriter.DEFAULT_LINE_END);           //As the table is static so creating headerRecord and writing it to csv file
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 438 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)