我有2个.py文件(data.py,access.py)
在access.py中,我有几个字符串:
Japan = ['brown', 'cow', 'around']
Korea = ['black', 'chicken', '344']
China = ['grey', '3411', 'leaf']
Indonesia = ['red', 'green', '']
在data.py中,我有一个模块:
def whichcolour(country)
print("access + country[1]") # Doesn't work
我的结果
我试图实现的是,运行whichcolour
到data.py
,它将返回/打印列表中的任何内容
我知道print(access.Japan[1])
有用。。它返回cow
如何编写print
语句,使其得到相同的结果
使用字典
访问.py
数据.py
输出:
我不是100%确定你想做什么(印尼有两种颜色),但这应该让你开始
相关问题 更多 >
编程相关推荐