Guest User

Untitled

a guest
Mar 23rd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. with open("file.txt", 'r') as file:
  2. istr = file.readline().strip()
  3.  
  4. buf = ''
  5. temp = ''
  6. out = open("out.txt", 'w')
  7. for i in istr:
  8. if i.isdigit():
  9. #print(type(buf), type(i))
  10. buf += i
  11. if i.isalpha() and buf != '':
  12. out.write(temp*int(buf))
  13. temp = i
  14. buf = 0
  15. out.close()
Add Comment
Please, Sign In to add comment