Home > Blockchain >  0x6llX from C to python?
0x6llX from C to python?

Time:08-30

I am using the following expression in C code:

sprintf(message, "0x6llX; ", someIntValue);

How do I do the same in python?

I know in C what it means.

  1. the mandatory % character
  2. a 0 flag for padding
  3. the 16 as "minimum field width"
  4. the ll as "length modifiers"
  5. the x conversion specifier

What I don't know, is how to do it in python...

CodePudding user response:

The same can be achieved using either of the following:

"0x6X; " % someIntValue            # Old style
"{:016X}; ".format( someIntValue )    # New style
  • Related