Convert Python input value

Asked 2 years ago, Updated 2 years ago, 20 views

data_pd = pd.read_excel('{}/{}'.format(Location,File),header = None, index_col=None, names=None)
data_pp = np.array(data_pd, str)
data_np = pd.DataFrame.to_numpy(data_pd)

inputBox = tkinter.Entry (window, text = "Code Input")
inputBox.pack
inputBox.place(x=320, y=120)
code = inputBox.get()
def rreset():
    code = inputBox.get()
    MK0000052971 = 1
    MK0000050290 = 2
    MK0000025689 = 3
    MK0000036067 = 4
    MK0000027876 = 5
    MK0000027445 = 6
    MK0000061907 = 7
    MK0000027447 = 8
    MK0000062328 = 9
    MK0000072940 = 10
    label1.config(text=str(data_np[code][Column]))
    label1.pack()
    label1.place(x=320, y=0)

If you put MK0000052971 in the input value, it changes to ->1 I want to put 1 in the code, but MK0000052971 goes in and there is an error. If I type the code, is there a way to convert it to 1?

python

2022-09-20 12:34

1 Answers

Well, I think this will solve the problem.

if code == 'MK0000052971':code=1
elif code == 'MK0000050290': code=2
elif code == 'MK0000025689': code=3
.
.
.


2022-09-20 12:34

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.