Basic Python help

mikael petterson mikaelpetterson1 at gmail.com
Fri Oct 23 06:41:31 EDT 2020


Hi,

I need to use the following code but in java.

 END_DELIM = '\n##\n'
 def start_delim(data_len): return '\n#%s\n' % (data_len)
  data = "%s%s%s" % (start_delim(len(data)), data, END_DELIM)

Can anyone help me to understand what it means:

I am guessing now:

a function defined "start_delim" takes the length of a data string.
function does modulo on something. This something I am not sure of
:-) 
Does '\n#%s\n' will this be evaluated to a number  when %s i replaced with data_len? 

Then the result is used as one parameter in "%s%s%s" 
start_delim then for the other
data
END_DELIM

Your help is greatly appreciated!

br,

//mike


More information about the Python-list mailing list