Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open("file.txt", 'r') as file:
- istr = file.readline().strip()
- buf = ''
- temp = ''
- out = open("out.txt", 'w')
- for i in istr:
- if i.isdigit():
- #print(type(buf), type(i))
- buf += i
- if i.isalpha() and buf != '':
- out.write(temp*int(buf))
- temp = i
- buf = 0
- out.close()
Add Comment
Please, Sign In to add comment