Python将多个变量分配给相同的列表值?
问题描述:
我正在编写一个计算日历日期的函数.在减少行数的同时,我发现我无法将多个变量分配到同一范围.
I'm writing a function to calculate calendar dates. While cutting down on lines, I've found that I am unable to assign multiple variables to the same range.
Jan, Mar, May, Jul, Aug, Oct, Dec = range(1,32)
会有一种有效的方法来分配这些值,为什么python会给出ValueError?
Would there be an efficient way to assign these values and why does python give a ValueError?
答
使用
Jan = Mar = May = ... = range(1, 32)