Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Highlight/Underline a string | ValueError: zero length field name in format
Hi, I'm building a python script which put an underline on a matched string on my regex pattern. Issue is when migrated to 2.6 I'm getting the below traceback. What would be the correct way to build this correctly?

finalout = re.sub(r'>.*(?=.*)', lambda m: '\x1b[4m{}\x1b[0m'.format(,compout)
print finalout
Traceback (most recent call last): File "", line 313, in <module> main() File "", line 302, in main finalout = re.sub(r'>.*(?=.*)', lambda m: '\x1b[4m{}\x1b[0m'.format(,compout) File "/usr/lib64/python2.6/", line 151, in sub return _compile(pattern, 0).sub(repl, string, count) File "", line 302, in <lambda> finalout = re.sub(r'>.*(?=.*)', lambda m: '\x1b[4m{}\x1b[0m'.format(,compout) ValueError: zero length field name in format
In python2.6 and earlier you need indices in the format specs


Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  MySQLdb._exceptions.ProgrammingError: not enough arguments for format string. farah97 0 38 Jan-22-2020, 03:49 AM
Last Post: farah97
  Highlight and remove specific string of text itsalmade 5 232 Dec-11-2019, 11:58 PM
Last Post: micseydel
  How to highlight the cell SriRajesh 3 235 Dec-08-2019, 02:17 PM
Last Post: michael1789
  Error in the code ->ValueError: could not convert string to float: ' ' eagleboom 1 384 Nov-29-2019, 06:19 AM
Last Post: ThomasL
  [ library recommendation ] search & highlight target texts in PDF? smallabc 1 162 Nov-27-2019, 10:40 AM
Last Post: Larz60+
  python gives wrong string length and wrong character thienson30 2 223 Oct-15-2019, 08:54 PM
Last Post: Gribouillis
  ValueError: could not convert string to float: . BoaCoder3 3 83,151 Aug-24-2019, 06:26 AM
Last Post: atlass218
  Underline title paul18fr 8 1,110 Aug-09-2019, 11:51 AM
Last Post: paul18fr
  Highlight text in pdf pramodb35 1 193 Aug-03-2019, 02:58 AM
Last Post: Larz60+
  remove underline from hyperlink in excel SriMekala 0 225 Jul-25-2019, 01:58 PM
Last Post: SriMekala

Forum Jump:

Users browsing this thread: 1 Guest(s)