怎么挂代理访问网站,网站解析是做a记录吗,天津电商网站开发,上海十大营销策划公司排名我试图在Django的日期字段中添加一些工作日。这是针对产品订购#xff0c;我们对不同的产品有不同的交付周期#xff0c;我们希望为每个产品生成一个目标日期。在例如#xff0c;产品X可能需要10个工作日才能交付#xff0c;如果此产品是在2013年3月1日星期五订购的#x…我试图在Django的日期字段中添加一些工作日。这是针对产品订购我们对不同的产品有不同的交付周期我们希望为每个产品生成一个目标日期。在例如产品X可能需要10个工作日才能交付如果此产品是在2013年3月1日星期五订购的则目标日期应为2013年3月15日星期五(不包括作为一天的订购日期)。在我环顾了一下似乎有一些python库可以完成这类工作但似乎都过于复杂了。我认为有一个相当简单的方法可以做到这一点。在**编辑**我现在使用的是BusinessHours PyPi包但是似乎遇到了一些问题。在他们给了你一个如何调用包的例子。在eg: Class: BusinessHours(datetime1,datetime2,worktiming[9 ,18],weekends[6,7],holidayfileNone)Class Parameters:datetime1 - The datetime object with the starting date.datetime2 - The datetime object with the ending date.worktiming - The working office hours . A list containing two values start time and end timeweekends - The days in a week which have to be considered as weekends sent as a list, 1 for monday ... 7 for sunday.holidayfile - A file consisting of the predetermined office holidays.Each date starts in a new line and currently must only be in the format dd-mm-yyyyfrom BusinessHours import BusinessHoursfrom datetime import datetimetesting BusinessHours(datetime(2007,10,15),datetime.now())print testing.getdays()利用这些信息我做了下面的测试脚本^{pr2}$我的假期文件包含以下内容(2月的一个随机工作日)07-02-2013当我运行脚本时我得到以下错误。在Traceback (most recent call last):File business_days, line 9, in ?print testing.getdays()File /usr/lib/python2.4/site-packages/BusinessHours.py, line 63, in getdaysholidate date(int(year) , int(month) , int(day))NameError: global name date is not defined这是包中的代码部分。在60 for definedholiday in definedholidays:61 flag0;62 day , month , year definedholiday.split(-)63 holidate date(int(year) , int(month) , int(day))64 for weekend in self.weekends:65 #check if mentioned holiday lies in defined weekend , shouldnt deduct twice66 if(holidate.isoweekdayweekend):67 flag1;68 break;感谢任何人给我的帮助我的Python版本是2.4.3