Python Forum
Color a table cell based on specific text
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Color a table cell based on specific text
#1
Hi Team,

Am trying to find syntax for html.replace to replace color of the td with specific text, for eg: If text A, color Green, if text B, color Red.

I tried like below but, it doesn't seem to work at all, TABLE:

1234 ABCDEF TEXT A
5678 ABCDEF TEXT B
0987 ABCDFEF TEXT A

html = html.replace("<thead>","<thead style=\"background-color:#00FF00\">")
html2 = html2.replace("<td=TEXT A>","<td style=\"background-color:#00FF00\">")
html3 = html3.replace("<td=TEXT B>","<td style=\"background-color:##FF0000\">")
Reply


Messages In This Thread
Color a table cell based on specific text - by Creepy - Jul-19-2023, 11:51 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Turtle Star Fill Color Yellow-White Interchanging Color Effect codelab 9 1,288 Oct-25-2023, 09:09 AM
Last Post: codelab
  Deleting rows based on cell value in Excel azizrasul 11 2,972 Oct-19-2022, 02:38 AM
Last Post: azizrasul
  Use module docx to get text from a file with a table Pedroski55 8 6,782 Aug-30-2022, 10:52 PM
Last Post: Pedroski55
  select Eof extension files based on text list of filenames with if condition RolanRoll 1 1,624 Apr-04-2022, 09:29 PM
Last Post: Larz60+
  Extracting Specific Lines from text file based on content. jokerfmj 8 3,252 Mar-28-2022, 03:38 PM
Last Post: snippsat
  How to perform DESC table sort on dates stored as TEXT type. hammer 7 2,390 Mar-15-2022, 01:10 PM
Last Post: hammer
  How to find tags using specific text (timestamps) in a url? q988988 1 1,454 Mar-08-2022, 08:09 AM
Last Post: buran
  Sum the values in a pandas pivot table specific columns klllmmm 1 4,826 Nov-19-2021, 04:43 PM
Last Post: klllmmm
  Extract text based on postion and pattern guddu_12 2 1,732 Sep-27-2021, 08:32 PM
Last Post: guddu_12
  Extract specific sentences from text file Bubly 3 3,574 May-31-2021, 06:55 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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