Python Forum
How to append multiple <class 'str'> into a single List
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to append multiple <class 'str'> into a single List
I have a variable called "link_list" that prints out multiple game-id URLs which I, using pythonic means, procured from a sports website. The terminal output looks something like this:

If I print using print(type(variable)) it shows the following <class 'str'> fields for each line


<class 'str'>
<class 'str'>
<class 'str'>
<class 'str'>
<class 'str'>
<class 'str'>
Now what I want is, to merge these results (URLs) in the form of a list so I can then run a selenium code snippet later on to get relevant data from these. How do I go about doing this? Any assistance on the matter would be appreciated.

Also here's my code for how I am procuring these values [THIS IS JUST FOR REFERENCE ONLY]:

#Importing all the necessary Libraries
import PySimpleGUI as sg
from selenium import webdriver
from import Options
from bs4 import BeautifulSoup
import urllib.request
from import Select
import pandas as pd
import re
import itertools

# Developing Simple Front End
label = [sg.Text("Please Enter Link")]
link = [sg.Input(enable_events=True, key='link')]
scrape_btn = [sg.Button("Scrape")]
exit_btn = [sg.Button("Exit")]
select_discipline = ['batting', 'bowling']
dropdown_discipline = [sg.Combo(select_discipline, enable_events=True, key='selection')]

#Developing Layout and Window Pane
layout = [label, link, dropdown_discipline, scrape_btn, exit_btn]
window = sg.Window("PCB Domestic Numbers", layout)

while True:
	event, values =
	if event == "Scrape":
		combo = values['selection']
		link = values['link']
		if combo == 'batting':
			driver = webdriver.Chrome()
			select = Select(driver.find_element_by_name('new_page_limit'))
			html = driver.page_source
			soup = BeautifulSoup(html, "html.parser")
			target_name = html[html.find("<h1 class="):html.find("</h1>")]
			name = target_name.split('by ')[1]
			link_list = []
			for link in soup.findAll('a'):
				if "match_id" in link.get('href'):
					link_list = link
					link_list = str(link_list)
					start = '="'
					end = '">'
					link_list = link_list.split(start)[1].split(end)[0]

		elif combo == 'bowling':

	if event == "Exit" or event == sg.WIN_CLOSED:


Messages In This Thread
How to append multiple <class 'str'> into a single List - by ahmedwaqas92 - Jan-07-2021, 05:20 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Ploting single column with multiple category drunkenneo 1 360 May-26-2021, 04:51 PM
Last Post: jefsummers
  Better way to append frames from a video to multiple lists? Balaganesh 0 225 May-13-2021, 07:37 AM
Last Post: Balaganesh
  Parse String between 2 Delimiters and add as single list items lastyle 5 430 Apr-11-2021, 11:03 PM
Last Post: lastyle
  apendng to a list within a class gr3yali3n 4 385 Feb-16-2021, 06:30 AM
Last Post: buran
  convert List with dictionaries to a single dictionary iamaghost 3 522 Jan-22-2021, 03:56 PM
Last Post: iamaghost
  Inserting multiple rows in a single request. swaroop 2 483 Jan-11-2021, 01:34 PM
Last Post: swaroop
  Fetching data from multiple tables in a single request. swaroop 0 321 Jan-09-2021, 04:23 PM
Last Post: swaroop
  Undo interation to make a single list? DustinKlent 2 431 Nov-29-2020, 03:41 AM
Last Post: DustinKlent
  How to append to list a function output? rama27 5 856 Aug-24-2020, 10:53 AM
Last Post: DeaD_EyE
  Append list into list within a for loop rama27 2 732 Jul-21-2020, 04:49 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020