Python basic Finishing (i)

Source: Internet
Author: User

1, character encoding:

Ascil code 255 One byte per character,

Unicode two bytes per character,

UTF8 variable-length Unicode encoding, English one byte, Chinese three bytes.

2. Format the string:

1)%s string

%d integers

%f floating Point

2) format formatted string

eg

#!/usr/bin/env Pyth

# _*_ Coding:utf-8 _*_

# Author:harvey Wang

Name = input (' Name: ')
Age = Input (' Age: ')
Job = input (' job: ')
Salary = input (' Salary: ')
info = ""
----------------Info----------------
Name:%s;
Age:%s;
Job:%s;
Salary:%s;
'% (name, age, job, salary)
Print (info)

Info2 = "'
----------------Info2----------------
Name: {_name}
Age: {_age}
Job: {_job}
Salary: {_salary}
". Format (_name=name,
_age=age,
_job=job,
_salary=salary)

Print (Info2)

Info3 = "'
-----------------Info3-----------------
Name: {0}
Age: {1}
Job: {2}
Salary: {3}
". Format (name, age, job, salary)

3. Circulation and Break,continue

Break end jumps out of the current entire loop

Continue jump out of the loop and into the next loop

While and for loops can use else

Python basic Finishing (i)

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.