Python Getting Started tutorial from:http://www.cnblogs.com/taowen/articles/11239.aspx Author: Taowen, Billrice
Lesson 1 ready to learn the Python environment
The download address is:
www.python.org
Linux version of I will not say, because if you
Python calls the local PowerShell method
1, now prepare a simple PowerShell script, the function is to test an IP list which can ping pass:
Copy Code code as follows:
function test_ping ($iplist)
{
foreach ($myip in $iplist)
{
Background
Recently, the company is doing message push, so naturally there will be many interfaces, testing process needs to call the interface, I suddenly feel that I can write a test framework?
Say dry, because the existing interface testing
In Python we have to determine whether a file has read, write, and execute permissions on the current user, and we can usually use the Os.access function for example:
# to Judge Read permission
os.access (, os. R_OK)
# judge Write permission
Where's the problem?
In Python, global variables are used to make this function available. At the same time, accessing the variable inside the function will be local and global.
In nested functions, the use of global can produce perverse behavior.
1) Os.path
1.1 Os.path.isabs (path) is an absolute path
1.2 Os.path.isfile (PATH)
1.3 Os.path.isdir (PATH)
Whether the 1.4 Os.path.islink (path) is a link, but returns false if the system does not support linking
1.5 Os.path.ismount (path) is a
Python version
To achieve more and better features than previous xxftp
1, continue to support multiple users
2, continue to support the virtual directory
3, increase the support user root directory and the right to map the virtual directory settings
Word for English words in the statistics are also very good, you may wish to try. If Word is not installed and you are also a program member, you can use my code. Pass the test, Word's statistic result is 18674, the software statistic result is 18349
Use of regular expressions
To learn the Python crawler, first you need to understand the use of regular expressions, so let's look at how to use them.
. The use of this time point is equivalent to a placeholder, you can match any one character,
This example describes Python's approach to judging image integrity based on pillow. Share to everyone for your reference, specific as follows:
1, install the third party library.
Pip Install Pillow
2. Examples of functions.
Find too many people will not use the waiting, bloggers today is really can't help to tell you the need to wait.
A lot of people in the group asked, the dropdown box is not positioned, the pop-up box is not positioned ... A variety of positioning
Copy Code code as follows:
# Coding=utf-8
From BeautifulSoup import BeautifulSoup, Tag, navigablestring
From Sentencespliter import Sentencespliter
From Os.path import Basename,dirname,isdir,isfile
From OS import makedirs
From Shutil
1, block-level scope
Would you like to run the following program at this time with output? Will execution succeed?
#块级作用域
If 1 = 1:
name = "Lzl"
print (name) for
I in Range (a): Age
= i
print (age)
Let's take a look at the
1. The method can be called must be objects, such as numbers, strings, lists, tuples, dictionaries, and even files are objects, Python everything is object.
str1 = ' Hello '
str2 = ' world '
str3 = '. Join ([STR1,STR2])
print (STR3)
>>> A = 2.5
>>> B = 2.5
>>> C = b
>>> A is C
False
>>> A = 2
>>> B = 2
>>> C = b
>>> A is C
True
Today, when we use the IS function to print a,b values of 2.5 and 2 respectively, we find that:
>>> A = 2
>>> B = 2
>>> ID (a)
21132060
>>> ID (b)
21
one, the threads in Python use:
There are two ways to use threads in Python: Functions or wrapping thread objects with classes.
1. Function: Invoke the Start_new_thread () function in the thread module to produce a new thread. The following example:
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