Https://docs.python.org/3/howto/logging.html#logging-basic-tutorialMore and better examples:Https://docs.python.org/3/howto/logging-cookbook.html#logging-cookbookImportLogging#set up logging to File-see previous sections for more detailsLogging.basicconfig (level=logging. DEBUG, Format='% (asctime) s% (name) -12s% (levelname) -8s% (message) s', Datefmt='%m-%d%h:%m', filename='/temp/myapp.log', FileMode='W')#define a Handler which writes INFO messages
()
parser.read (' Multisection.ini ')
For candidate in [' wiki ', ' bug_tracker ', ' Dvcs ']:
print '%-12s:%s '% (candidate, parser.has_section (candidate))
Testing if a section exists before calling get () avoids to exceptions for missing data.
$ python configparser_has_section.py
wiki : True
bug_tracker:true
dvcs : False
Use Has_option () to test if is option exists within a section.
From Configparser import safeconfigparser
) d]% (levelname) s% (message) s ',Datefmt= '%a,%d%b%Y%h:%m:%s ',Filename= ' Myapp.log ',Filemode= ' W ')##################################################################################################定义一个StreamHandler, print Info-level or higher log information to a standard error and add it to the current log-processing object #console = logging. Streamhandler ()Console.setlevel (Logging.info)Formatter = logging. Formatter ('% (name) -12s:% (level
calls the log output function
% (created) f
Current time, expressed as a floating-point number of the UNIX standard representation time
% (relativecreated) d
The number of milliseconds since the logger was created when logging information is output
% (Asctime) s
The current time in the form of a string. The default format is "2003-07-08 16:49:45,896". The comma is followed by a millisecond
% (thread) d
The thread ID. May not have
python crawler-beautiful soup-as book catalog (1)
For the first time, use Python + beautiful soup to crawl some data and use it as a book catalog as an exercise.
idea:-1. Get when the book Category: Class Report name + link URL
Effect:
Script Description:- 1. mylog.py: Log- 2. getbookkindinfo.py: Book catalogue mylog.py
#!/usr/bin/env python #-*-coding:utf-8-*-' Created on 2018-4-10 @author: Administrator ' "' Import logging import get Pass Import SYS defines mylog class class MyLog (object): "
animation, and to is the end state of the animation.So the method is to make an element rotate 360 degrees clockwise, very simple.The from-to often does not meet our daily development needs, so there is this writing@keyframes run_animation{ 0%{Transform:rotatex (0DEG);} 16%{ transform:rotatey ( -90deg); } 33%{ Transform:rotatey ( -90deg) Rotatez (135deg); } 50%{ Transform:rotatey (225deg) Rotatez (135deg); } 66%{ Transform:rotatey (135deg) Rot
target position. you may assume that the start position and the target position will never be a trap, and there will never be a monster at the start position. inputthe input contains several test cases. each test case starts with a line contains two numbers N and M (2 By the end of file. more details in the sample input. outputfor each test case, You shoshould output "God please help our poor hero. "If Ignatius can't reach the target position, or you shoshould output" it takes n seconds to reac
:(1,4)->(1,5)11s:(1,5)->(2,5)12s:(2,5)->(3,5)13s:(3,5)->(4,5)FINISHIt takes 14 seconds to reach the target position, let me show you the way.1s:(0,0)->(1,0)2s:(1,0)->(1,1)3s:(1,1)->(2,1)4s:(2,1)->(2,2)5s:(2,2)->(2,3)6s:(2,3)->(1,3)7s:(1,3)->(1,4)8s:FIGHT AT (1,4)9s:FIGHT AT (1,4)10s:(1,4)->(1,5)11s:(1,5)->(2,5)12s:(2,5)->(3,5)13s:(3,5)->(4,5)14s:FIGHT AT (4,5)FINISHGod please help our poor hero.FINISH
Autho
....XX.XXXXX.5 6.XX.1...X.2.2...X....XX.XXXXX15 6.XX.....XX1.2...X....XX.XXXXX.
Sample output
It takes 13 seconds to reach the target position, let me show you the way.1s:(0,0)->(1,0)2s:(1,0)->(1,1)3s:(1,1)->(2,1)4s:(2,1)->(2,2)5s:(2,2)->(2,3)6s:(2,3)->(1,3)7s:(1,3)->(1,4)8s:FIGHT AT (1,4)9s:FIGHT AT (1,4)10s:(1,4)->(1,5)11s:(1,5)->(2,5)12s:(2,5)->(3,5)13s:(3,5)->(4,5)FINISHIt takes 14 seconds to reach the target position, let me show you the way.1s:(
weapon is simple, and it will not take long for new recruits to use it.The penetration of P90 is very strong. FN once demonstrated to the experts the experiment of penetrating 48 layers of Kaifu bulletproof vests at a distance of 100 meters, while at the same distance, A 12S assault gun with Beleta cannot penetrate the above target clothing. The effective range of P90 is 250-meters. When using a high-speed high-caliber bullet similar to a shell-pierc
ManualResetEvent implementation asynchronous wait, over time not to do processing, continue to execute code down(ManualResetEvent involves a task that a thread must complete before other threads do it)1manualresetevent[] MRE =Newmanualresetevent[2];2 3mre[0] =NewManualResetEvent (false);4SHOPPINGBLL SPB =NewSHOPPINGBLL (mre[0], dict);5Thread THD1 =NewThread (NewThreadStart (SPB. Getgprice));6 THD1. Start ();7 8mre[1] =NewManualResetEvent (false);9FAREBLL PFB =NewFAREBLL (mre[1], dict);TenThread
animation.
So the method is to make an element rotate 360 degrees clockwise, very simple.
The from-to often does not meet our daily development needs, so there is this writing
@keyframes run_animation{ 0%{Transform:rotatex (0DEG);} 16%{ transform:rotatey ( -90deg); } 33%{ Transform:rotatey ( -90deg) Rotatez (135deg); } 50%{ Transform:rotatey (225deg) Rotatez (135deg); } 66%{ Transform:rotatey (135deg) Rotatex (135deg); } 83%{ Tran
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.