我是想把一個檔案內的字,放到陣列裡面
那些字我想轉成十六進制,有轉成功!但是值放不進去。。以下是我的程式碼
import numpy as np
fileName = input ("輸入檔案名稱:")
file = open(fileName,"r")
#abc = np.zeros((4,4))
abc = np.zeros((4,4))
i = 0
for j in range (4):
for i in range (4):
text = file.read(1)
#print("text"+" "+str(text))
textB = text.upper()
#print("textB" +" "+ str(textB))
text2 = ord(text)
#print("textord" +" " + str(text))
text3 = hex(text2)
print("texthex" +" "+text3)
abc[j][i] = text3
#print(abc)
https://i.imgur.com/MvN4C9P.jpg