UNIX timestamp: the number of seconds that have elapsed since midnight on January 1, January 1, 1970 (UTC/GMT), regardless of the leap second.
Take 25/JUL/2012: 13: 26: 58 as an example.
Python program:
Import time
Import datetime
X = datetime. datetime. strptime ('25/JUL/2012: 13: 26: 58 ',' % d/% B/% Y: % H: % m: % s ')
Time. mktime (X. timetuple ())
Output:
1343194018.0
Note:
Description of formatting the time string in the strptime function:
%
Right triangle of Chinese character graphicsDescribeGet a Chinese character entered by the user, output as a shape (here with asterisks instead of Chinese characters):Requirements arranged neatly, note: The output of the above graphic, blank space can not be used, to use Chinese space, the Chinese space corresponding to the Unicode code 12288.Input formatA Chinese characterOutput formatAs shown in the formatting effect.Input Output sample
Input
Output
Ex
integer is removed, and 03 is not enough 3 digits to the left of 0Print "PI=%03.F"% Math.PI#output:pi=003 #%6.3f indicates that the decimal point is accurate to 3 digits, with a total length of 6 digits, including a decimal point, not enough left fill spacePrint "pi=%6.3f"% Math.PI#output:pi=_3.142 #%-6.3f indicates that the decimal point is accurate to 3 digits, with a total length of 6 digits, including a decimal point, not enough right fill spacePrint "pi=%-6.3f"% Math.PI#output:pi=3.1
:OUTFILEINS.W Rite (s) outfilEins.write ("\t\t\t\t" +writestr3+ "\ n") elif S.find (FINDSTR4)! = -1:outfileins.write (s) outfileins.write (" \t\t\t\t\t "+writestr3+" \ n ") elif S.find (" Cs_oslgis ")! = -1:outfileins.write (S.replace (" Cs_oslgis "," CQ_RMW ")) Elif S.find ("and A.longitude >")! = -1:outfileins.write ("\t\t\tand a.longitude is not Null\n\t\t\tand a.longit UDE is not Null\n\t\t\tand rownum Copyright notice: This article blog original article. Blogs, without consent, may not b
Python processes text files and generates files in the specified format,
Import OS import sys import string # Open the specified file in the specified mode and obtain the file handle def getFileIns (filePath, model): print ("Open File") print (filePath) print (model) return open (filePath, model) # obtain the file to be processed def getProcFile (path): return OS. listdir (path) # determine whether a condit
Merge offline data of Baidu audio and video with python 2.3 format update, python2.3
It has not been updated for a long time.
The resolution in four formats is supported.
Filelist
Slicelist
Download. cfg
Third_party_download.cfg
Or two files. Replace the previous version.
The preliminary test is normal, but the timeline is incorrect.
# -*- coding: UTF-8 -*-import osimport ioimport codecsimport stringimport
Today write a basic tutorial in the second project, mainly using Python to make a PDF diagram, relatively simple.First we need to install the module PIP install Reportlab can be Used.The book is to use Urlopen from up and down a txt file, and then open processing to get the data, because I did not get data from this URL path, so directly write a bit of data in the Program.Urlopen is relatively simple, later written crawler will often use, so here is n
Import requests# tag = ' http://exercise.kingname.info/exercise_ajax_1.html ' #最开始的网址, below two for child link URL = '/http/ Exercise.kingname.info/ajax_1_backend ' url2 = ' http://exercise.kingname.info/ajax_1_postbackend ' req = Requests.get ( URL) of print (req.text)params = { ' name ': ' xx ', ' Age ':' req2 ' = Requests.post (url2,json=params). Textprint (REQ2)Note: The Red dash section is key, and you can also use Postman to parse it.Postman Link: HTTP://OUAPI.COM/TOOL/GP, the use of
1. Write to Excel, you do not need to create a new excel at the beginning, will automatically generateAttribute_proba is the object I wrote.Import XLWT = XLWT. Workbook () = Myexcel.add_sheet ('sheet') si=-1 SJ =-1 for in attribute_proba: si=si+1 for in I: sj=sj+1 sheet.write (Si,sj,str (j)) SJ=-1 myexcel.save ( "attribute_proba_big.xls"2. Write txt, you need to create a new TXT file from the beginning F=open ('f:/goverment/myf
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.