Python Learning Path---programming style specification

Source: Internet
Author: User

1. Import Module:

Import osfrom OS import systemimport socketserver as SS  --alias 2, use the TAB key: [[email protected] python]# cat tab.py#py Thon Startup FileImport sysimport readlineimport rlcompleterimport os#tab completionreadline.parse_and_bind (' tab: Complete ') #history Filehistfile = Os.path.join (os.environ[' HOME '), '. Pythonhistory ') #try: #       Readline.read_history_file (histfile) #except ioerror:#       PASS3, formatted output: #!/usr/bin/env Pythonthis_ Year=2015name=raw_input (' What's Your Name: ') age=int (raw_input. ') sex=raw_input (' How old is you? Dep=raw_input (' How old is? ') ') messages = ' Information of the company staff:        name:%s        Age:%S&N Bsp       Gender:%s        DEP:%s        '% (NAME,AGE,SEX,DEP) prin T messages  4, normalized output:  1 #!/usr/bin/env python  2 import sys  3 user = ' Cheeron '   4 TIMES=0&N Bsp 5 while True:  6   If times<3:  7     name = Raw_input (' What's Your Name: '). Strip ()   8     If len (name) = = 0:  9         print ' name is not empty,please input a name '  10   &NBSP ;     continue 11     elif user = name: 12         pass 13   &N Bsp else: 14         print "%s is not right,please sign in agin!"% name 15         times+=1 16         continue 17     break 18   else: 19 &NB Sp   Sys.exit ()  20 age = Int (raw_input ')  21 sex = raw_input (' Please input your gender: ')  22 dep = raw_input (' Please input your job: ')  23 print "Welcome to sign in", Name  1 #!/usr/bin/env python  2 Import sys  3 user = ' Cheeron '   4 times=0& nbsp 5 while true:  6     name = Raw_inputR name: '). Strip ()   7     If len (name) = = 0:  8         print ' name is not empty,p Lease input a name '   9         CONTINUE&NBSP;10     for I in range (3):  11   & nbsp     name = Raw_input (' What's Your Name: '). Strip ()  12         if user = = Name: 13             pass 14         else: 15       &NB Sp     Print "%s is not right,please sign in agin!"% name 16             Contin ue 17         break 18     else: 19         print "has lo Gin 3 Times,exit " 20         sys.exit ()  21     break 22 age = Int (Raw_input (' How is old is you? ')  23 sex = raw_input (' Please input your gender: ')  24 dep = raw_input (' Please input your job: ')  25 PRint "Welcome to sign in", name

Python Learning Path---programming style specification

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.