Python Forum
How to ignore empty columns from DB?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to ignore empty columns from DB?
#1
Hello,

As I read rows from a database and concatenate some columns into a string, some columns are empty.

What is the correct way to ignore those when building the string, and avoid having "None\n"?

for row in rows:
	#How to avoid eg. "Col3 stuff\nNone\nCol 5 stuff" ?
	bigstring = f'{row["col3"]}\n{row["col4"]}\n{row["col5"]}'
Thank you.
Reply
#2
Have a look at this and see if it's what you need.
where name is not null
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags


Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Good way to ignore case when searching elements? Winfried 0 34 1 hour ago
Last Post: Winfried
  Ignore WakeWord after it's said Extra 2 1,189 Apr-01-2022, 12:32 AM
Last Post: Extra
  How to ignore "Retrying (Retry(total=2, connect=2, read=5, redirect=5, status=None))" const 3 2,713 Mar-26-2022, 08:55 AM
Last Post: ndc85430
  Ignore first few letters of a line when reading file. ShakeyPakey 16 6,393 May-30-2020, 02:17 PM
Last Post: BitPythoner
  How to make the script ignore down devices. wagnergt12 4 3,215 Apr-20-2020, 11:45 PM
Last Post: wagnergt12
  Regex ignore JohnnyCoffee 1 2,601 Mar-16-2020, 12:16 PM
Last Post: scidam
  Ignore Folder Evil_Patrick 3 3,733 Oct-29-2019, 07:44 AM
Last Post: Gribouillis
  How to ignore formulas when reading excel file SriMekala 3 6,525 Aug-16-2019, 04:04 PM
Last Post: buran
  How to ignore - ERROR: The system was unable to find the specified registry key or va asheru93 9 6,661 Feb-04-2019, 06:35 AM
Last Post: asheru93
  Ignore character in if statement Fizo 6 3,652 Sep-09-2018, 12:39 PM
Last Post: Fizo

Forum Jump:

User Panel Messages

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