fork download
  1. st = '''a b c
  2.  
  3. d
  4. '''
  5.  
  6. for line,l in enumerate(st.splitlines()) :
  7. for col,c in enumerate(l):
  8. if c != ' ' : print('[{},{},{}]'.format(c,col,line)) #Python3.5
  9.  
  10. # if c != ' ' : print(f'[{c},{col},{line}]') #Python3.6
  11.  
Success #stdin #stdout 0.01s 27712KB
stdin
Standard input is empty
stdout
[a,0,0]
[b,2,0]
[c,4,0]
[d,0,2]