First python learner.
An array of text data of the specified class of the web page,
I want to make CSV for each person who has commented.
However, only the last person on the page can vomit.
Thanks for your teaching.Applicable source code
AAA = soup.find_all ('div', class_ = 'xxx') for BBB in AAA: CCC = BBB.getText () DDD = CCC.replace ('\ xa0', '') eee = [x.strip () for x in DDD.split ('\ n') if not x.strip () == ''] print (eee) #Terminal confirmation with open (r "eee", 'wt', encoding = 'cp932') as file: writer = csv.writer (file, lineterminator = ',') writer.writerows ([eee])
I wondered if it wasn't a multidimensional array.
Multi-dimensional array can not be made well, CSV output only at the end ('div', class_ = 'xxx').
Answer # 1
AAA = soup.find_all ('div', class_ = 'xxx') with open (r "eee", 'wt', encoding = 'cp932') as file: writer = csv.writer (file, lineterminator = ',') for BBB in AAA: CCC = BBB.getText () DDD = CCC.replace ('\ xa0', '') eee = [x.strip () for x in DDD.split ('\ n') if not x.strip () == ''] writer.writerows ([eee])
- python3 tkinter i want to be able to input only character strings in a fixed format
- python 3x - some emojis cannot be obtained by scraping using python
- python 3x - i want to convert a character string to a byte string as it is
- python - perform a character string search on the dataframe using the for statement and divide it into multiple dataframes
- the size of the input candidate character and the confirmed character are different in python tkinter
- i want to extract a log file (text file) containing a specific character string with python
- python 3x - insert the value obtained in the a file into the text box in the b file
- python 3x - python3: if there is a specific character string in the file, i want to divide the process and execute it only once
- python - how to get child elements from the element obtained with bs4elementtag
- java - i want to put a symbol in the character obtained from edittext separated by 2 digits
- i want to display the value obtained by socket communication in python with flask in html on the browser, but it is not displaye
- python - about setting the character spacing in the text widget in tkinter
- python 3x - i want to make a function that converts the emoji sent in the list to utf-8 character code
- python - let me judge whether the input character is a half-width number
- i want to perform ambiguous character replacement in python
- i want to use python to extract a line containing a specific character and the next two lines
- python - i get an error message like invalid character in identifier
- python calculated with the obtained result
- python - error when converting from numpy array to tensor "valueerror: failed to convert a numpy array to a tensor (unsuppo
- python - i want to save the information obtained by scraping in excel for each sheet
- i want to display screens with different window sizes when i press the [python/tkinter] tab
- python - i get an error when connecting to a voice channel with discordpy
- python - i want to ignore the header and loop
- about combining when there are duplicate values in python dictionary type
- python - [opencv] i want to display the area of each object at the position adjacent to the object
- python - i don't know how to process blocking processes in parallel
- i want to connect to 64-bit ms access from 32-bit python
- i want to wait until the next process can be performed after executing the process in python
- python - i want to determine if the channel is a text channel
- error display on python discord bot