Python Sixth day

Source: Internet
Author: User

Computer broke for a week, but fortunately in the small north of the wit of the strong proud of the power to make it a reborn, and then fight 5 years no problem ~ ~ ~ said this computer or the North sophomore time to buy, used also has more than 4 years ah, in this also thanks to a small partner, after all, the northern Windows system is really ignorant

Well, today's content is really simple, because it was in the redhat when the get to the

1. Regular Expressions:

Regular expression:
. Match any character (except \ n)
[...] Match Character Set
\d \d matching numbers match non-digits
\s \s match blank match fly white space character
\w \w matches a word character [a-za-z0-9] matches a non-word character
* Match the previous character 0 or unlimited times
+ Match the previous character 1 or unlimited times
? Match a previous character 0 or 1 times
{m} {M,n} matches the previous character M or n times
*? +??? Match pattern to non-greedy mode (match as few matches as possible)
^ Match string start
$ match End of string
\a \z Specifies that the string match must appear at the Beginning (end)
| match any one expression to the left
(AB) The expression in parentheses as a grouping
\<number> A string that refers to a grouping that is numbered num
(? p<name>) Assign an alias to the group
(? P=name) reference to a grouping match string with alias name

Search (pattern,string,flags=0) finds a match in a string
FindAll (pattern,string,flags=0) finds a match and returns a list of all matching parts
Sub (pattern,repl,string,count=0,flags=0) replaces the part of a string that matches a regular expression with a different value
Split (pattern,string,maxsplit=0,flags=0) returns a list of split strings based on the matching split string

Re. I ignore case

In fact, these do not have any eggs at all, the key moment is special to try to try, Grandpa's my knife?

2. Reflection: Lying trough, this thing is really a bunker! The Bunker! The Bunker! Proud of the north, said it bunker! Imagine this thing how ferocious, concrete, this bunker of things I will not come out to share to other people's, hehe

3.os with SYS: can directly adjust the system command, the world suddenly a lot of spacious, I can save the Earth, the most important point ~ ~ ~

1 # !/usr/bin/env python 2 Import OS 3 Import SYS 4 sys.path.append (Os.path.dirname (Os.path.dirname (Os.path.abspath (__file__)))

4. Encryption: Can be used to save the shame of the thing OH

1 #!/usr/bin/env python2 ImportHashlib3obj = hashlib.md5 (Bytes ('Mengmengda', encoding='Utf-8'))4Obj.update (Bytes ('123', encoding='Utf-8'))5R =obj.hexdigest ()6 Print(R)7 8C:\Users\Administrator\AppData\Local\Programs\Python\Python35\python.exe c:/users/administrator/pycharmprojects /ace/study6/lib/jiami.py9 0b6ca5dd011a2887f57ba52f1754bca8Ten  OneProcess finished with exit code 0

5. Sell a Moe:

1 #!/usr/bin/env python2 ImportSYS3 ImportOS4 Import Time5 6 defview_num (num, total):7rate = num/ Total8rate_num = Int (Rate * 100))9R1 ='\r%s%d%%'%('#'*num, rate_num)Ten sys.stdout.write (R1) One Sys.stdout.flush () A  - if __name__=='__main__': -      forIinchRange (0, 101): theView_num (i, 100) -Time.sleep (0.05) -  -C:\Users\Administrator\AppData\Local\Programs\Python\Python35\python.exe c:/users/administrator/pycharmprojects /ace/study6/lib/s1.py + ########################################### #44% -Process finished with exit code 1

The North now computer performance is too good ~ ~ ~

Python Sixth day

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.