如何在python中自动将文本置于逗号之间
好的,我用python编写了一个脚本,它从一个网站上抓取数据并打印出来,但打印方式是这样的 但我希望它输出如下:如何在python中自动将文本置于逗号之间,python,Python,好的,我用python编写了一个脚本,它从一个网站上抓取数据并打印出来,但打印方式是这样的 但我希望它输出如下: 283049610,5785985,93709266 这是我的代码: from selenium import webdriver from bs4 import BeautifulSoup import re path = 'C:\chromedriver' options = webdriver.ChromeOptions() options.add_argument(&q
283049610,5785985,93709266
这是我的代码:
from selenium import webdriver
from bs4 import BeautifulSoup
import re
path = 'C:\chromedriver'
options = webdriver.ChromeOptions()
options.add_argument("--mute-audio")
options.add_argument("--headless")
driver = webdriver.Chrome(path, options=options)
driver.get('website')
soup = BeautifulSoup(driver.page_source, 'html.parser')
items = soup.find('div', {'class': 'mix_container'})
for item in items.find_all('div', {'data-ref': 'item'}):
print(re.search('\d+', item.find('a')['href']).group())
“,”.join(map(str),)
其中sequence是任何一组可数的数字。使用f''或''.format()print(sep=','))
print(stre.search('\d+',item.find('a')['href'])。group()r1,end=',')
@Shijith谢谢兄弟,工作顺利