从大括号扩展中排除

时间:2017-06-08 07:12:58

标签: bash brace-expansion

我知道

echo {1..10}

DO

1 2 3 4 5 6 7 8 9 10

但我不想要6和7.是否可以排除它?

3 个答案:

答案 0 :(得分:2)

也许您可以使用以下内容:

    import logging
    from StringIO import StringIO
    formatter = logging.Formatter('%(asctime)s %(name)-3s %(levelname)-4s %(message)s')

    log_stream1 = StringIO()
    log1 = logging.getLogger('a')
    log1.setLevel(logging.DEBUG)
    stream_handler1 = logging.StreamHandler(log_stream1)
    stream_handler1.setLevel(logging.INFO)
    stream_handler1.setFormatter(formatter)
    log1.addHandler(stream_handler1)

    log_stream2 = StringIO()
    log2 = logging.getLogger('b')
    log2.setLevel(logging.DEBUG)
    stream_handler2 = logging.StreamHandler(log_stream2)
    stream_handler2.setLevel(logging.INFO)
    stream_handler2.setFormatter(formatter)
    log2.addHandler(stream_handler1)

    log1.info('log1')
    log2.info('log2')

答案 1 :(得分:1)

作为一种解决方法,echo {1..5} {8..10}可能就足够了。

答案 2 :(得分:1)

可以用

完成
CreatePageLocator pf;

public AppTest_Blankrder()
{}


/* Below code is used to open the browser....*/
@BeforeTest
public void testSetup() {


    System.setProperty("webdriver.chrome.driver", "./testdata/chromedriver.exe");
    driver= new ChromeDriver();

     driver.manage().timeouts().implicitlyWait(500, TimeUnit.SECONDS);
     driver.get("http://loginapp.group/");


}

    @Test(dataProvider="WosLoginData",dataProviderClass=CreateProvider.class,priority = 1)
    public void WOSLogintest(String user,String password)
    { 

        System.out.println("Open Logintest method and pass data");


        // -----page factory code---
    CreatePageLocator pf= new CreatePageLocator(driver);

        pf.setUserName(user);

        pf.setPassword(password);

        pf.clickLogin();

    }

但我找到了另一个解决方案:

public class CreatePageProvider {
@DataProvider(name="WosLoginData")
public Object [][] getLoginData(Method name)
{
    Object [][] data=null;
    /
    ExcelDataConfig config=new com.ExcelDataConfig("./testdata/InputData.xlsx");
    int rows=config.getRowCount(0);

                data=new  Object[rows][2];

    for(int i=1; i<rows; i++)
    {
        data[i][0]=config.getData(0, i, 0);
        data[i][1]=config.getData(0, i, 1);



    }


enter code here
    return data;
}