Python for loop for printing n lines after every n-th line -


i want loop on binary file , print specific bytes. how can use loop print out n bytes after every n-th byte.

an example: numbers 0...10, printing 2 numbers after every 3 numbers equal output: 3, 4, 8, 9.

while don't want encourage questions ask code without presenting attempt along expected vs actual output, point out don't have change step size of loop:

for in xrange(3,20,5):   print   print i+1 

[edit]

note xrange present in python < 3, range has taken on role in >= 3.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -