First, encapsulate the data attributes, clearly differentiate inside and outside: The sample code is as follows:1 classpeople:2 def __init__(self, Name, age):3Self.__name=name4Self.__age= Age5 6 defTell_info (self):7 Print('name: age'
#文件操作的其他方法###############################################################################文件的内置操作函数# 1.closed See if the file is closed, output as Boolean, turn off true, not closed to false# 2.encoding represents the form of encoding, the encoded
A. py file can be seen as a module that resembles a class library encapsulated in other languagesModule Categories:Built-in ModulesCustom ModulesThird-party modules (need to be installed to use)I want to use the functions defined in cal.py, I can do
Create a file under Linux called hello.py, and enter
1
Print ("Hello world!")
Then execute the command: Python hello.py, output
123
localhost:~ jieli$ vim hello.
In the first half of the semester, I have always thought that the second half of the semester will learn C language, and I heard that C language is difficult to understand, programming language is not easy to understand, his heart also with a bit of
OS module provides an interface for invoking the operating system1. Get the current path>>> Import OS>>> OS.GETCWD ()//equivalent to Linux command pwd'/root '2. Switch directories>>> Os.chdir ("/usr/local")//equivalent to Linux command CD>>>
Python was born in the era of complex information systems, which is an option of the evolution of the computer age.Python features, common language, scripting language, cross-platform language. This language can be used for pervasive computing, not
Random Number Module1. Take a random floating-point number between 0-1>>> import Random//Importing random module>>> Random.random ()//random method to take a random floating-point number between 0-10.36983506915898345Is it possible to take random
# Coding=utf-8import turtle# the way to draw a pentagram def drawpentagram (x): Turtle.begin_fill () turtle.color (' yellow ') for I in Ran GE (5): Turtle.forward (x) turtle.right (144) Turtle.end_fill () def gotopoint (x, Y, z): Turtle.penup () tu
Python _ decorator and python decorator
I learned about the Python decorator today. To sum up, I hope you can correct the mistakes.
The python modifier is actually a function, but it allows other functions to add functions without changing the
Basic and advanced functions of Python Numpy (text), pythonnumpy
Similarly, your computer must own Python and install the Numpy library. If you have any questions, refer to here ~~~~
Let's start with the following:
The main object of NumPy is a
Floating Point network transmission, floating point transmission
Operating System: CentOS7.3.1611 _ x64
Gcc version: 4.8.5
Python version: 2.7.5
The idea is as follows:
1. Copy floating point number a through memory and assign it to integer data B
Re-recognize python,
Why? I started learning python a few months ago, but I have never made any progress. It is just a matter of common problems in other languages, that is, the new learning is about 0.
Later, I found some suitable teaching
Python full-stack development: python List, pythonlistList
A list is a frequently used data type in python and is used to store multiple values.
Format: separated by commas (,) in []. You can store n values of any type.
Eg:
# Single type users =
Python full stack development-Day3 string, python-day3 stringFull-stack python development-Day3 string1. Start string learning based on the following points:
#1. Basic usage
1. Purpose
# First, the main function of a string: name, gender,
Write and test WordCount-Python implementation, wordcountpython
Address of this project on github: https://github.com/MaximumRescue/WordCount-ProjectPreface
First, I must emphasize that,If you think there is a problem, you must have not carefully
The default return value when defining a function in python.
When defining a function in python, the returned value is usually specified. If the returned value is not explicitly specified, python returns None by default, that is, the implicit
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