我有一个Python脚本,在这一点上使用硬编码的输入值来计算算法。
from sys import stdin
from sys import stdout
capacity=13;
num_of_items=6;
total_weight=0;
total_value=0;
#Dictionary to store item numbers and corresponding weights
#<Item number, weight>
item_weight={0:4,1:2,2:3,3:1,4:7,5:10};
#Dictionary to store item numbers and corresponding values
#<Item number, value>
item_value={0:6,1:4,2:5,3:3,4:9,5:7};我不知道如何从文本字段输入值。
因此,输入值将具有来自用户的capacity , num_of_times, total_weight , total_value,以及来自用户的作为字典输入的item_weight和item_value。
根据一些人的建议尝试了Yattag,但是我不能让它工作。
在这方面的任何帮助都是非常感谢的。
发布于 2018-05-13 01:01:49
使用“flask”框架,这将启用来自HTML的HTTP请求
https://stackoverflow.com/questions/50291030
复制相似问题