'% (DH, h)) if DH! = H Else Open (Os.pat H.join (IPP, PF), ' WB '). Write (by) 2.3 If you click Perference, the package Control option succeeds, or the installation fails, the failure is nothing, you can configure the environmentThree, configuration packageClick on the new package Control, enter installEnter the installation interface: I install two plugins myself:1.SideBarEnhancements = Sidebar Management2.Anaconda (the strongest
Python learning notes (3) and python learning notes
1. in python source code files, if you use non-ASCII characters, you must declare the character encoding in the file header. The declaration is as follows:# Code: UTF-8
2. Unicode encoding: This is the encoding of All characters in the world. Of course, there is no pr
Python Object-Oriented Programming (3) and python Object-Oriented Programming
Encapsulation
1. Why encapsulation?
Encapsulation is to hide the specific implementation details of data attributes and methods and only provide one interface. Encapsulation does not concern about how objects are built.
2. encapsulation includes data encapsulation and function encapsula
In the blog (python Local data acquisition URL: http://blog.csdn.net/sxingming/article/details/51333663), we detail the various ways in which files are read and written in Python.
In this article, 5 examples are given to illustrate the file's read and write operations.
1 The string in the file Companies.txt with the ordinal 1,2,3 ... Later, write to another file
screen, install and then enter Anaconda in the new Window command line and click on the first option to install.Modify in Settings-defaultAfter Python_interpreter is the Python default installation location, my Python installation directory is in E:\Python\python.exe, note the backslashThe Settings-user is configured
(1, num_num + 1)Print "BEFORE:", fac_list
I = 0
While I If num_num % fac_list [I] = 0: # Check whether the input number can be divisible by an element in the list.Del fac_list [I]I = I + 1
Print "AFTER:", fac_list[Execution result]Enter a number: 12BEFORE: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]AFTER: [2, 4, 5, 7, 8, 9, 10, 11]
6-8.List. An integer value is give
T def get_name(self): if self.check_t(): return self.name else: return "no person"if __name__ == "__main__": f = Foo("canglaoshi") name = f.get_name() print name #Python 3: print(name)It is optimized to move the functions that were originally placed outside the class into the class, that is, the function check_t() is now Foo within the namespace
command window, perform pip install PEP8 pyflakes2. Switch to Sublime Text software,3. Install the SUBLIMELINTER-PEP8, Sublimelinter-pyflakes plug-in4.preferences->package settings->sublimelinter->settings5. On the right side of the popup window (User), enter the following:{"Pep8": {Whether to show Pep8 check (true to show, false not shown)"@disable": true,"args": [],"Excludes": [],"Ignore": "",Limit the length of each row to 120"Max-line-length": 12
ObjectiveThe environment has been set up in the front, which begins with the formal learning of Selenium's webdriver framework. We usually say selenium automation, in fact, it is not similar to QTP and other GUI-like visualization tools, we want to learn is the Webdriver framework of the API.This article mainly tells how to use Python to invoke the API of the Webdriver framework, to do some general operations on the browser, such as open, forward, bac
Python learning-stage comprehensive exercises 3. python Comprehensive ExercisesPython learning-comprehensive phase Exercise 3
Based on the previous class learning, do the following example exercises: operations that contain folders and files (do not read the code first, and try to write it first. The code is for refere
#!/usr/bin/env python#-*-Coding:utf-8-*-age = 3if age >= 18:print ' adult ' elif age >= 6:print ' teenager ' Else:prin T ' Kid ' print '----------------------' names = [' Jie ', ' Bob ', ' Trcy ']for name in Names:print nameprint '------------------- -----' sum = 0for x in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:sum = sum + xprint sumprint u '-----------range (integer ge
Python core programming Second Edition 97th Page Chapter 5 exercisesI will share with you the answer to my core Python programming.Because it is not from official resources, it is your own exercises. It may be wrong or not the best solution.
[Recommendation] share a programmer's book "A good book read"Http://debug-sai.blogbus.com/logs/42178629.html
; json.dump ([' Streaming API '], io)>>> Io.getvalue ()' ["Streaming API] 'Second, Encode (Python->json)1. First of all, why should encode,python inside bool value is true and False,json inside bool value is true and false, and case-sensitive, this is embarrassing, obviously is bool value.The code written in Python, uploaded to JSON, is certainly not recognizable
Python learns Day 5 high-level functions map/reduce filter sorter return functions anonymous function decorators partial functions, pythonsorter
Higher-orderfunction
Variable can point to function
>>> Abs # abs (-10) is a function call, while abs is the function itself.
>>> F = abs # the function itself can also assign values to variables.
>>> F # variables can point to functions.
>>> F (-10) # variable
first section, the first direct python test.py time, then successively imported sys模块和math模块 , because it is directly imported module, then the full name is SYS, while importing the SYS module, although the current directory has the SYS module, but the SYS module is the system module, Therefore, the SYS module of the system is returned directly in the Import_submodule. The math module is not a pre-loaded module, so it will be found and loaded in the
This series of blogs takes notes from learn python the hard way.
1. Because the five chapters to be viewed today is a review of the nature of the content, the content in the front is integrated, so there is no new content
OnlyCodePaste it here
View code
Print " Let's practice everything. " Print " You \ 'd need to know \ 'bout escapes with \ that do \ n newlines and \ t tabs. " Poem = """ \ T the lovely wordwith logic so firmly pl
data = [Ten, 4, 3, 8, one, 5, ten, 2, 1, +, +] "' idea: How many elements are looped, and each cycle starts from the first element and compares it to the elements behind it, if Larger than the back, in exchange, the largest number of the first cycle will be placed at the end, the next cycle will be less traversing a single number. ' for in Range ' (Len (data)-1): the For in range (len (data ) (j):
the number of variables and values around the assignment symbol (=) should be exactly the same. (2) chain-assigned valuechained Assignment (chained Assignment) is a shortcut to assigning the same value to multiple variables. x=y=somefunction ()The effect is the same as the following statement:x=somefunction ()y=xHowever, these two sets of statements and the following statements do not necessarily rank:x=function ()y=funcition ()(3) Incremental assign
This article mainly introduces how to use Python arrays. For more information, see 1. Python arrays can be divided into three types:
(1)List common linked listAfter initialization, you can dynamically add elements through specific methods.Definition method: arr = [element]
(2)Tuple fixed arrayOnce defined, the number of elements cannot be changed.Definition method: arr = (element)
(2)Dictionary typeThat is
Python learning day 5 List and tuple, pythontuple
List and tuple:
Python provides a type similar to the C language array, but it is quite simple to use. Let's talk about list and tuple in this magical python.List type:
1. Directly paste the Code:
L = ['A', 'B', 'C'] // declare A Listprint L
Output ['A', 'B', 'C']
Declare a List type and use the identifier.
2. Obt
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.