Example:
Reporter = driver.find_element_by_xpath("/html/body/div[1]/section/div[1]/div[3]/div/div/div/div/div/div/div[2]/div/issuetable-web-component/table/tbody/tr[" + p + "]/td[5]/span/a").get_attribute('rel')
s = Reporter
Output:
user1
user2
Expected:
user1,user2
You could try to format that output:
your_string = """
user1
user2
"""
If you need it as a tuple like your comment:
new_tuple = tuple(your_string.strip().splitlines())
Or as a string:
",".join([str(x) for x in your_string.strip().splitlines()])
Considering your loop is filling Reporter which is a list of Strings
Reporter = driver.find_element_by_xpath("/html/body/div[1]/section/div[1]/div[3]/div/div/div/div/div/div/div[2]/div/issuetable-web-component/table/tbody/tr[" + p + "]/td[5]/span/a").get_attribute('rel')
// joins elements of Reporter by ',' and stores in sting s
s = ","
s = s.join(Reporter)
Maybe try the following and check -
s = s.replace('\n', ',')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.