一、__init__.py的作用
当需要加载自定义的目录下所有文件时,让该目录识别为package,则目录下需要有__init__.py 文件,另外在模糊加载时,也需要定义 例如: __all__ = [“Pack1Class”,”Pack1Class1″], 总结如下:
Python中package的标识,不能删除
定义__all__用来模糊导入
编写Python代码(不建议在__init__中写python模块,可以在包中在创建另外的模块来写,尽量保证__init__.py简单)
二、python中时间差中seconds和total_seconds
在python中经常会用到计算两个时间差,两个日期类型进行相减可以获取到时间差
经常会使用seconds来获取,其实seconds获取的是时间差的秒数,遗漏了天
seconds是获取时间部分的差值,而total_seconds()是获取两个时间之间的总差
import datetime t1 = datetime.datetime.strptime("2016-08-24 10:30:00", "%Y-%m-%d %H:%M:%S") t2 = datetime.datetime.strptime("2016-08-24 12:30:00", "%Y-%m-%d %H:%M:%S") interval_time = (t2 - t1).seconds # 输入的结果:7200 total_interval_time = (t2 - t1).total_seconds() # 输出结果也是: 7200 # 换一个方式t1 = datetime.datetime.strptime("2016-08-24 10:30:00", "%Y-%m-%d %H:%M:%S") t2 = datetime.datetime.strptime("2016-08-27 12:30:00", "%Y-%m-%d %H:%M:%S")interval_time = (t2 – t1).seconds # 输入的结果:7200 total_interval_time = (t2 – t1).total_seconds() # 输出结果也是: 266400
三、 遍历数组获取索引下标
for i, one_js in enumerate(js_actions):
四、Python出现’ascii’ codec can’t encode characters…的解决方法
第一步,别忘了给顶行加上:
# -*- coding: utf-8 -*-
第二步,重新载入SYS模块并设置uft-8
import sys
reload(sys)
sys.setdefaultencoding(‘utf-8’)
Casinacho Casino Review: Games and Banking for Canadian Players. Casinacho Casino Review: Games and Banking for Canadian Players Casinacho Casino is a popular online casino that offers a wide range of games and banking options for Canadian players. In this https://casino-casinacho.ca review, we will take a closer look at the games and banking services that Casinacho Casino has to offer to its Canadian customers. Games Casinacho Casino offers a wide variety of games for Canadian players to enjoy. From classic table games like blackjack and roulette to popular slot games like Starburst and Gonzo’s Quest, there is something for everyone at Casinacho Casino. The casino also offers a selection of live dealer games, where players can interact with real dealers and other players in real-time. One of the standout features of Casinacho Casino is its selection of progressive jackpot games. These games offer players the chance to win life-changing sums of money with a single spin of the reels. Popular jackpot games at Casinacho Casino include Mega Moolah and Hall of Gods. Banking Casinacho Casino offers a variety of banking options for Canadian players to deposit and withdraw funds. Players can use credit and debit cards, e-wallets, and bank transfers to make transactions at the casino. Deposits are usually processed instantly, while withdrawals may take a few days to process depending on the chosen payment method. Casinacho Casino also takes player security seriously, using encryption technology to protect players’ personal and financial information. Players can feel confident that their data is safe and secure when playing at Casinacho Casino. Overall, Casinacho Casino offers a great gaming experience for Canadian players. With a wide selection of games, including progressive jackpot games, and a variety of banking options, players are sure to find something they enjoy at this online casino. Whether you are a fan of table games, slots, or live dealer games, Casinacho Casino has something for everyone. In conclusion, Casinacho Casino is a top choice for Canadian players looking for a reliable and entertaining online casino experience. With its wide selection of games and secure banking options, players can feel confident that they are in good hands when playing at Casinacho Casino. So why not give it a try and see what all the fuss is about?