Content of this week's job:1. Display the default shell of root, fedora or User1 user on the current system;[[email protected] home]# grep-e "^ (root|fedora|user1) \>"/etc/passwd |cut-d:-f1,7 root:/bin/bash User1:/bin/bash Fedora:/bin/bash
Python Development Lightweight Crawler (IMOOC summary 07--page parser BeautifulSoup)BeautifulSoup download and install using PIP install: After command line cmd input, pip install Beautifulsoup4beautifulsoup syntax is divided into three parts.
Python provides two basic socket modules.The first one is the Socket, which provides the standard BSD Sockets API.The second is Socketserver, which provides a server-centric class that simplifies the development of Web servers.The following first is
rules for IF statements1. Each "If statement" must contain an else. 2. If this else should never be executed, because it has no meaning in itself, then you must use a function called die after the Else statement to print out the error message and
Python read-write configuration file in the actual application has a very powerful function, in the actual operation also has a fairly simple operation, the following article is the Python read-write configuration file specific program introduction,
Python Object-orientedPython has been an object-oriented language since its inception, which is why it is easy to create a class and object in Python.
Introduction to Object-oriented technology
class: used to describe a collection of
43, the Python module socket:Python is powerful in network communication, learn the basic way of socket communicationUDP communication:Server:Import Socketport=8081s=socket.socket (Socket.af_inet,socket. SOCK_DGRAM) #从指定的端口, from any sender,
In some versions of Python, when installing, we can choose the Python path automatically when installingWhen choosing the Python installer, We try to choose the Python 2 version, because Python's database will become more and more powerful as Python
A range ([Start,] stop[, step]) is specified in the previous section of a, and a sequence is generated based on the range defined by start and stop and step set by step.Like what:
1
>>> range(5)
2
First, process-oriented programmingSimply put: If you're just writing some simple scripts to do some one-off tasks, it's great to use a process-oriented approach, but if you're dealing with a complex task that needs to be iterative and maintainable,
Built-in functionsMany of the features of Python already have built-in functions, sorted alphabetically by the followingABS (x)Return absolute ValueAll (iterable)Parameter is an iterative object and returns True if all elements in an iterator object
1. Note the differences between the two codes3=4print (b)3=4(in Python, variables are simply labeled)2.str = r"c:\\w\e\we\weee""\ \"print (" str")3. (Version 2.7)month =int(Raw_input ("Please enter the number of months:")) Day=int(Raw_input
1, the Replication/etc/skel directory is/home/tuser1, requires/home/tuser1 and its internal files belong to the group and other users do not have any access rights.[[email protected] ~]# cp -r /etc/skel/ / home/tuser1 #使用cp命令带-R option:
python encoding ConversionThis paper mainly introduces the encoding mechanism of Python, the conversion between Unicode, Utf-8, utf-16, GBK, gb2312,iso-8859-1 and so on. Common encoding conversions are divided into the following
Constant definition rule: constant meaning is not changed; Constant definition name is all uppercase;such as: mysql_connection= ' 192.168.1.1 'Pyc:python generated translation files that enable the computer to recognize the Python language;Syntax
Transfer from http://blog.csdn.net/rebelqsp/article/details/22109925Python provides two basic socket Modules.The first one is the Socket, which provides the standard BSD Sockets API.The second is socketserver, which provides a server-centric class
Python built-in functions, which can be build-in Functions via Python's help document, can be viewed via commands under terminal interaction>>> dir ("__builtins__") [' __add__ ', ' __class__ ', ' __contains__ ', ' __delattr__ ', ' __dir__ ', ' __doc_
Set, copy in depth, copy in Depth
1. set: Aggregates different elements to form a set. It is also a data type in Python.
Unchangeable data type: Number, string, and tuples variable type: List, Dictionary
Purpose: remove duplicates from the
Python uses the module pytz to convert the time zone, pythonpytz
Preface
Recently I encountered a problem: MyserverAndclientNot in a time zone,serverThe time zone is EDT, that is, the eastern United States time zone,clientThat is, my own computer.
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