0

I have a txt file written like this:(enter image description here)

1 !
2 "
3 #
4 $
5 %

and I want to make an array that would be like this

array = {'!':1,'"':2,'#':3,}

with open("Vaja2bTabela.txt", encoding="utf-8") as f:
content = f.readlines()
content = [x.strip() for x in content]

and this is what I get:

['1 !', '2 "', '3 #', '4 $', '5 %',..]
Anshul
  • 1,413
  • 2
  • 6
  • 14

0 Answers0