Python Forum
[SOLVED] [sqilte3] Check if column not empty?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] [sqilte3] Check if column not empty?
#1
Hello,

Some rows might have an empty column.

How can I check it's filled with data?

file = open("output.txt", 'at',encoding='utf-8')
for row in cur.execute("select id,introtext,fulltext from content"):
	soup = BeautifulSoup(row["introtext"], 'lxml')
	file.write(soup.body.text)
	
	#Not null?
	#AttributeError: 'NoneType' object has no attribute 'text'
	#if row["fulltext"]:
	if len(row["fulltext"]):
		soup = BeautifulSoup(row["fulltext"], 'lxml')
		file.write(soup.body.text)
file.close()
Thank you.
Reply


Messages In This Thread
[SOLVED] [sqilte3] Check if column not empty? - by Winfried - Jan-28-2023, 03:44 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [solved] list content check paul18fr 6 885 Jan-04-2024, 11:32 AM
Last Post: deanhystad
  Delete empty text files [SOLVED] AlphaInc 5 1,685 Jul-09-2022, 02:15 PM
Last Post: DeaD_EyE
  Check if clients are online with ips stored in json [SOLVED] AlphaInc 6 2,689 Jun-27-2022, 08:28 AM
Last Post: AlphaInc
  [Solved] Reading every nth line into a column from txt file Laplace12 7 5,429 Jun-29-2021, 09:17 AM
Last Post: Laplace12
  Python Openpyxl is unable to check from Column 6 onwards Skye 0 1,798 Oct-13-2020, 06:11 AM
Last Post: Skye
  write to excel will be empty in column jacklee26 7 3,522 Jun-27-2020, 12:09 AM
Last Post: snippsat
  Check for a special characters in a column and flag it ayomayam 0 2,110 Feb-12-2020, 03:04 PM
Last Post: ayomayam
  How to get previous non empty value of another column klllmmm 1 1,874 Feb-02-2020, 12:22 PM
Last Post: klllmmm
  find empty cells in a column Pedroski55 2 23,969 Sep-18-2017, 01:27 PM
Last Post: Pedroski55
  How to check if the data is empty in a database? chris0147 8 20,598 Aug-28-2017, 12:03 AM
Last Post: Fran_3

Forum Jump:

User Panel Messages

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