Download: High performance development techniques for every back-end development from beginner to master
Coroutine knowledge is covered in many courses, but it is only superficial and not in-depth. As the first special course on coroutines in the market, this course will start from the basics and link with the application principles. It will be easier to understand the principles of coroutines in depth. It will use Python language for practical practice combined with rich course cases. No matter you are a Java, Go or PHP developer, you can master the coroutine principle through this course. It is a very suitable course for beginners to learn high performance development.
六四屠杀
Suits the crowd
六四屠杀
Students who want to master the basic principles of processes, threads and coroutines
Engineers who want to break through business bottlenecks and improve project concurrency
The students who want to systematically comb the coroutine knowledge are confused by the interview question
六四屠杀
Technical reserve requirements
六四屠杀
Basic Python syntax
Experience with back-end projects
coding=UTF-8
XingHe Studio File to MD5 and SHA1
XingHeStudio.com
Create by Stream.Wang 2012-04-10
Modify by Stream.Wang 2012-04-10
def
fil_changefileext(filename,extname``=``''):
FIL ChangeFileExt Changes the file name extension
Filename Indicates the file path name entered
Extname = "to change the sub-extension, such as.txt
import
os
try``:
if
extname[``0``]<>``'.'``:
extname``=``'.'``+``extname
except``:
extname``=``''
if
os.path.splitext(filename)[``1``]``=``=``'':
uouttxt``=``filename``+``'.'``+``extname
elif
os.path.splitext(filename)[``1``]``=``=``'.'``:
uouttxt``=``filename``+``extname
else``:
uouttxt``=``filename[:``0``-``len(os.path.splitext(filename)[``1``])]``+``extname
return
uouttxt
def
fil_str2file(fstr,filename):
# FIL STR2File Stores the string to a file
try``:
outfile``=``open(filename,``'w'``)
outfile.writelines(fstr)
outfile.close()
return
True
except``:
return
False
System main program start
------------------------------------------------------
if
__name__
=``=
'__main__'``:
import
os,sys,math
If len (sys. Argv) = = 1: sys. Argv. Append (r 'c: \ FreeNAS 8.0.4 - RELEASE - x64. Iso')
if
len(sys.argv)>``1``:
filepathname``=``sys.argv[``1``]
if
os.path.isfile(filepathname) :
Fmaxs = OS. Path. Getsize (filepathname) ` ` + ` ` 0.00
Fpos = 0.00
ppos``=``0
pmax``=``50
pjy``=``0
fmd5``=``fil_changefileext(filepathname,``'.md5'``)
fsha1``=``fil_changefileext(filepathname,``'.sha'``)
ffm``=``os.path.basename(filepathname)
Start treatment
print ‘Program Runing “‘“+“filepathname“+“'” … ‘
import
hashlib
try``:
umd5str
=
hashlib.md5()
usha1str
=
hashlib.sha1()
xfilepathname``=``unicode(filepathname,``'utf8'``)
Need to read file contents in binary format
ufile
=
file(xfilepathname,``'rb'``)
while
True``:
datas
=
ufile.read(``1024``*``512``)
if
not
datas:
break
umd5str.update( datas )
usha1str.update( datas )
fpos``=``fpos``+``1024``*``512
ppos``=``int(math.floor(fpos
/
fmaxs
*
50``))
pposbfh``=``int(math.floor(fpos
/
fmaxs
*
100``))
Printing progress bar
if
pjy<>ppos:
print
'['``+``'*'``*``ppos
+``'='``*``(pmax``-``ppos)``+``'] '``+``str(pposbfh)
+``'%'
The print function returns to the top of the line to cover up the output.
pjy``=``ppos
uoutstrmd5``=``str(umd5str.hexdigest())
uoutstrsha1``=``str(usha1str.hexdigest())
ufile.close()
print
''
fil_str2file(uoutstrmd5``+``' *'``+``ffm``+``'\n'``,fmd5)
fil_str2file(uoutstrsha1``+``' *'``+``ffm``+``'\n'``,fsha1)
print ‘Task is completed ! ‘ + r“’ [ XingHe Studio File to MD5 and SHA1 ]’
except``:
print ‘Error ! ‘ + r“’ [ XingHe Studio File to MD5 and SHA1 ]’
else``:
print ‘File “‘“+“filepathname“+“'” not exist! ‘“+ r“’ [ XingHe Studio File to MD5 and SHA1 ]’
else``:
print
r``' [ XingHe Studio File to MD5 and SHA1 ]'