0527 Python Basics 01

Source: Internet
Author: User

Handling of broken lines \
>>> print "Hi \
... hello lucy! "
Hi Hello lucy!

Natural strings, strings plus R or R prefixes specified
>>> stringb=r "A\NB"
>>> Print STRINGB
A\nb
>>> stringa= "A\NB"
>>> Print Stringa
A
B

Recommended Editor
Sublime
Eclipse+pydev
Ulipad
Pycharm (free version)

Text mode run Python

#-*-Coding:utf-8-*-
# D:\python\test.py
print "Hello World 0527"
Print 123
Print U "Hello"
The print U "4>3 expression result is:", 4>3

C:\users\***>python d:\python\test.py
Hello World 0527
123
How are you doing
4>3 expression result is: True

The difference between job 1:ansi and UTF8
Ansi
Utf-8

Operator
>>> Print 4>3
True
>>> Print 4<3
False

Logical operations
>>> print True and False # Boolean with, as long as there is a condition of false, the expression is false
False
>>> print True or False # Boolean or, as long as there is a condition of true, the expression is true
True

Using variables to receive input from the keyboard
>>> str1 = raw_input ("Please enter character:")
Please enter a character: How are you?
>>> Print str1
How are you?

An expression
Read a number, *10 the numbers and print them out.
>>> NUM1 = raw_input ("Input number NUM1:")
Input Digital num1:43
>>> print int (NUM1) *10
430
>>> Print num1*10
43434343434343434343

>>> num2 = Int (raw_input ("Input number num2:"))
Input Digital num2:23
>>> Print num2*10
230

Raw_input () The value of the string type is stored
>>> Numa=int (raw_input ("input number A:"))
Input Digital A:6
>>> Numb=int (raw_input ("input number B:"))
Input Digital B:7
>>> Print Numa*numb
42
>>> type (raw_input ("Please enter")
Please enter 5
<type ' str ' >
>>> "5"
' 5555 '
>>> 5*4
20

Job 2:
Read in length and width, calculate the area and perimeter of the rectangle
Working with file formats

Common DOS Commands
In general, we do not need to delve into the essence of each DOS command, it is sufficient to understand some of the more commonly used DOS commands.
1. DIR: List disk files and directories
The dir command can be said to be one of the most widely used commands in DOS, which can be used to list all the disk files and directories under the current path, with many parameters, common such as:/d: Files are listed by column,/p: Paused after each information screen;/w: Format with wide list; X: Displays the short name produced as a non-8dot3 file name.
2. Copy copy File
The copy command can be said to be one of the most versatile commands in DOS, and not only can we copy files and rename files by using the Copy command. You can also create Autoexec.bat and Config.sys files (which can be useful when you can't use the edit editor), or even print files and merge files. The format is:
COpY [Source disk] [path]〈 source file name 〉[target disk] [path] [target file name]
3. DEL: Delete Files
The del command deletes one or more specified files (but cannot delete the folder), and if you type the "DEL * * *" command will delete all files under the current path, a confirmation prompt will be requested for confirmation. If you want to delete a folder, you can use the deltree command, which is an external command.
4. CD: Displays the current directory name or changes the current directory
CD is one of the most frequently used commands in DOS. The main purpose is to quickly switch to another drive or directory, such as "CD G:temp" to quickly jump to the "g:temp" directory, using "CD." You can go back to the top-level directory and use "CD" to quickly return to the root of the current disk.
5. FDISK: Hard Disk partitioning
This is a very dangerous DOS command, its role is to partition the hard disk, after use will lose all the files on the hard disk. Novice don't use this command easily.
6. Format: Advanced formatting
Whether it is a hard disk or a floppy disk, must be advanced format before you can use, the function of the Format command is Advanced format disk, if you add the/s parameter can be made system disk, plus/q parameter executable Quick format.
7. SYS: Passing System files
In addition to using the FORMAT/S command to make a system disk, we can also use the SYS command to pass system files, such as "C:> SYS A:" To pass the system files of the C drive to a drive, which is particularly useful when restoring system files on a computer with multiple operating systems installed.
8. SMARTDRV: Disk buffering Program
If you have ever had the experience of installing the Windows operating system under DOS, then you must know that before installing the SMARTDRV program, you will not be able to endure the long installation time of torture! And if you want to load the SMARTDRV program, be sure to load Himem.sys at the same time.

0527 Python Basics 01

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.