Python First day job

Source: Internet
Author: User

First write a little put up, not complete, Monday to the company in the optimization bar.

Here the user input is written to the file, using variables, this variable was studied overnight.

F.write ('%s \ n% variable ') also unexpected variables are written outside ().

Localhost:python dong$ cat denglu.py #!/usr/bin/env pythonf = open ('/Users/ Dong/documents/java/python/zh ', ' W ') Logou_flag = falsefor i in range (3):     user_input=raw_input (' please,user:  '). Strip ()     if len (user_input)  == 0:        print  ' Error:you must input  sth as name. '         continue    else:         f.write ('%s\n '  % user_input)     password=raw_input (" please,password : "). Strip ()     if len (PASSWORD)  == 0:         print  ' Error:you must input sth as password '         continue    else:         f.write ('%s\n '  % password )          f.flush        f.close    print  ' Success! '

Localhost:python dong$ cat en

1

1

2

2

3

3


This article from the "Clear Sky" blog, declined reprint!

Python First day job

Related Article

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.