Https://stackoverflow.com/questions/3718657/how-to-properly-determine-current-script-directory-in-pythonThe more commonly used is the following sentenceos.path.dirname(os.path.abspath(__file__))But if you use Exec, the above approach does not work
Meta-groupA python tuple is similar to a list, except that the elements of a tuple cannot be modified .Tuples use parentheses, and the list uses square brackets.Tuple creation is simple, just add elements in parentheses and separate them with commas.
Niche Blog:http://xsboke.blog.51cto.comNiche Q q:1770058260------- Thank you for your reference, if you have any questions, please contact
One, string processing1. How to handle strings650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01
One, rpm commandMount the disc file to the/media directoryGo in the Packages directory under the/media directoryView all RPM packages that the system has installedTo see if the system installs DHCP packagesInstalling DHCP PackagesViewing information
Iterators===============================Related concepts1. Iteration Concept: Repeat + the result of the last iteration is the initial value of the next iterationA repeating process is called an iteration, one iteration at a time,And the result of
######################## #消费者 #################################!/usr/bin/env python# -*- coding: Utf-8 -*-# author: changhua gongimport pika ' fanout mode: Radio-like broadcast mode, receiver (consumer), then receive If the receiver is absent, the
1. Raw string (Raw String)If a string contains many characters that need to be escaped, it can be cumbersome to escape each character. To avoid this situation,We can prefix the string with R to indicate that it is a raw string, and that the
A friend asked me the regular,, okey, in fact, my regular is not good, but Python under the XPath is relatively simpleGet a quick look at XPath:XPath is a language that looks for information in an XML document. XPath can be used to traverse elements
1. Strings can be enclosed in ' or ', if the string itself contains ' What should I do? For example, we want to represent stringsI ' m OK, then you can use "" to denote: "I m OK".If the string itself contains ", you can use ' surround ' to indicate:
The implementation code is as follows:#!/usr/bin/python#*-*coding:utf8*-*import osimport sysimport hashlibdef md5sum (data): with open (data, "RB") as f: MD5=HASHLIB.MD5 () #赋空值 for i in f.read (4096): #防止遇到大文件打开太占用内存,
5.21,python the second section, at the beginning, I feel I came to the foot of the Shu Road, looked up, full of towering, the bottom of my heart and do not have a little bit of anticipation [* blush *]But I think the work of each section is the
Directory
1. Preparatory work
2. Installation
3. Configure _VIMRC
4. Writing and compiling the running program
BodyConfiguring Gvim as a Python IDE under WindowsBack to top 1. Preparatory workDownload the following
Positioning element MethodsWebsite address: http://selenium-python.readthedocs.org/locating-elements.htmlHere are a variety of strategies for locating elements in a Web page (locate elements), you can choose the most appropriate scenario, selenium
Show List:l[0]Traversing List:print (L) and for loopsUpdate List:append () and insert () and direct assignmentDelete List:pop () and pop (n)List features:can add delete?
123456
li = [ ' Adam ' ' Lisa ' Bart ' '
In the process of using php.cn/wiki/1514.html "target=" _blank ">python, it is found that when the function parameter is list, the call to List.append () inside the function changes the formal parameter, which is not the same as that of C + +. Check
1. PIP installation (PIP is "A tool for installing and managing Python packages.", which means Pip is a Python software installation Tool)Yum-y Install Epel-releaseYum-y Install Python-pipYum-y Install Python-develYum-y Install gcc*2. Download
5.25 continue break for while, 5.25 continue
# _ Author: "ljk"# Date: Latest /5/25#1. break: interrupt the current loop# For I in range (10): # print 5-9# If I # Continue # Jump out of the current loop# Print (I)# For j in range (10 ):# Print
Day6 subprocess module, logging module, day6subprocess
Logging Module
Many programs need to record logs, and the information contained in the logs has normal program access logs, and may also have errors, warnings, and other information output, the
Python core programming language (version 3)
It comprehensively covers many fields in today's application development. It provides intermediate Python developers with practical methods. It covers a large number of practical code cases. The exercises
Day6 time and datetime modules, day6datetime
Time Module
The time module provides functions for various operation times.
#1. Seconds after January 1, January 1, 1970#2. tuples include: year, day, week, etc.... time. struct_time#3. formatted string
(1
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