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])
- get all the character positions of half-width spaces with python
- python - when converting from webm to mp4, the conversion is possible but combined
- i want to aggregate a specific character string by day using the python groupby count function etc
- python - sum of numbers by inputting a character string
- i want to extract one character string of text that exists in multiple files with python
- [python] i want to interweave character strings and data with write () of file writing
- python 3x - beautiful soup an exception occurs when the character string is extracted
- about character acquisition by python scraping
- python that wants to extract only "october 31, 2020 (saturday)" from the character string "october 31, 2020 (satu
- python - i want to handle files with the path obtained by ospathjoin
- extract a line containing an arbitrary character string in a python regular expression text file and write it to an excel file
- python 3x - beautiful soup i want to extract a specific character string
- syntax error: invalid character in identifier in python
- python - i want to get the file name and open it with openpyxl using the obtained file name
- store the data obtained by spython requests in the list
- python - how to format (extract) only the json part of a character string that contains some json
- python - i want to convert the characters obtained from the txt file to numbers
- processing using the len function when an integer value is obtained from python standard input
- python - how to check the character code on mac
- python - how to search for duplicate characters in the character string
- python : The sample code of "Transition to specified url" cannot be executed
- python : Windows server creating a daemon like on Linux
- python : Byte when printing the output of an external command
- python : There is a link in the code. How to find out how many times a person has followed it?
- When I try to start a Python simple web server, "python.exe is incompatible with the version of Windows I'm running."
- python : tkinter member reference fails
- python : I want to display the half-width slash "\" correctly in the Windows jupyter notebook