Python Tutorial
❮ Home Next ❯
Learn Python
Python is a popular programming language.
Python can be used on a server to create web applications.
Start learning Python now »
Learning by Examples
With our "Try it Yourself" editor, you can edit Python code and view the result.
Example
print["Hello, World!"]
Try it Yourself »
Click on the "Try it Yourself" button to see how it works.
Python File Handling
In our File Handling section you will learn how to open, read, write, and delete files.
Python File Handling
Python Database Handling
In our database section you will learn how to access and work with MySQL and MongoDB databases:
Python MySQL Tutorial
Python MongoDB Tutorial
Python Exercises
Test Yourself With Exercises
Exercise:
Insert the missing part of the code below to output "Hello World".
["Hello World"]
Start the Exercise
Python Examples
Learn by examples! This tutorial supplements all explanations with clarifying examples.
See All Python Examples
Python Quiz
Test your Python skills with a quiz.
Python Quiz
My Learning
Track your progress with the free "My Learning" program here at W3Schools.
Log into your account, and start earning points!
This is an optional feature, you can study W3Schools without using My Learning.
Python Reference
You will also find complete function and method references:
Reference Overview
Built-in Functions
String Methods
List/Array Methods
Dictionary Methods
Tuple Methods
Set Methods
File Methods
Python Keywords
Python Exceptions
Python Glossary
Random Module
Requests Module
Math Module
CMath Module
Download Python
Download Python from the official Python web site: //python.org
Kickstart your career
Get certified by completing the course
Get certified
w3schoolsCERTIFIED.2022❮ Home Next ❯
Hướng dẫn dùng idle cyber python
Bài viết này được tác giả viết vào 5/6/2013. Dịch lại cho anh em tham khảo.Tác giả nói rằng: Tôi đã từng là lập trình viên Java trước khi tôi chuyển qua ...
Hướng dẫn calculate sigma python
Hướng dẫn dùng define comprehend pythonNội dung chínhList comprehension trong Python là gìSử dụng list comprehension để tạo list trong PythonCú pháp list comprehension trong ...
Hướng dẫn 2**3 in python
In the following examples, input and output are distinguished by the presence or absence of prompts [>>> and …]: to repeat the example, you must type everything after the prompt, when the ...
Hướng dẫn dùng define zipped python
Nối tiếp tutorial về lập trình Python, hôm nay chúng ta sẽ học cách tạo ra file zip bằng cách sử dụng Python, thông qua thư viện zipfile. Thư viện này là build-in ...
Remove backslash from json python
I am using python url library to get json response from spatial reference website.This is my code. I get response_read=u{type: EPSG, properties: {code: 102646}} but i need this ...
Hướng dẫn python flat map list
You can concatenate lists using the normal addition operator:>>> [1, 2] + [3, 4] [1, 2, 3, 4] The built-in function sum will add the numbers in a sequence and can optionally start from a ...
Hướng dẫn dùng ls python python
Vietnamese [Tiếng Việt] translation by Dai Phong [you can also view the original English article] Unix là một hệ điều hành được phát triển vào khoảng năm 1969 tại AT & T ...
Hướng dẫn python random example
Trong bài này mình sẽ hướng dẫn bạn cách tạo số ngẫu nhiên bằng cách sử dụng module random trong Python. Với module này bạn có thể tạo ra một số ngẫu nhiên ...
Hướng dẫn dùng to_csv python python
Thư viện pandas python là gì? Nó có thể giúp bạn những gì và làm sao để sử dụng thư viện pandas này trong lập trình python. Hãy cùng tôi đi tìm câu trả lời ...
Hướng dẫn python collections
Module collection trong Python được định nghĩa là một bộ chứa được sử dụng để lưu trữ các bộ sưu tập dữ liệu, ví dụ: list, dict, set và tuple,... Nó ...
Hướng dẫn glob glob trong python
Nội dung chínhLấy danh sách tên file và thư mục trong python | os.listdir[]Lấy danh sách tên file trong thư mục python | os.path.isfile[] Lấy danh sách tên thư mục trong ...
Hướng dẫn dùng r+b python python
Python cung cấp các chức năng cơ bản và phương thức cần thiết để thao tác các file. Bài viết này tôi xin giới thiệu những thao tác cơ bản nhất với file trong ...
Hướng dẫn import library python
Bài viết được sự cho phép của tác giả Nguyễn Chí ThứcModule được sử dụng để phân loại code thành các phần nhỏ hơn liên quan với nhau. Hay nói cách khác, ...
Hướng dẫn dùng open csv python
Hướng dẫn cách xử lý file CSV trong python. Bạn sẽ học được cách đọc file csv trong python dưới dạng list bằng hàm csv.reader hay dưới dạng dictionary bằng class ...
Hướng dẫn python deque to list
The problem is to rotate a list by moving the numbers from the right, k times. e.g. [1,2,3,4,5,6,7] with k=3 will rotate the numbers from the right one at a time and move them to the top of the list ...
How do you distribute probability in python?
View DiscussionImprove ArticleSave ArticleReadDiscussView DiscussionImprove ArticleSave ArticleA probability Distribution represents the predicted outcomes of various values for a given data. ...
Set attribute in class python
Usually, we define classes for this.class XClass[ object ]: def __init__[ self ]: self.myAttr= None x= XClass[] x.myAttr= magic x.myAttr However, you can, to an extent, do this with the ...
Hướng dẫn dùng math atan python
Hàm atan[] trong Python trả về arctan của x, giá trị radian.Cú phápCú pháp của atan[] trong Python:Ghi chú: Hàm này không có thể truy cập trực tiếp, vì thế chúng ta ...
Hàm việt thường trong python
Hướng dẫn chuyển chữ hoa thành chữ thường và ngược lại, chuyển chữ thường thành chữ hoa trong python.Bạn sẽ học được cách chuyển chữ hoa thành ...
Hướng dẫn python recursion return
Một hàm gọi chính nó được gọi là hàm đệ quy. Kỹ thuật lập trình này gọi là đệ quy.Nội dung chính2. Chương trình xuất dãy số fibonacci sử dụng hàm đệ ...
Hướng dẫn python f-string format
Mục lục bài viết:Định dạng chuỗi cũ bằng PythonTùy chọn #1: %-formatTùy chọn #2: str.format[]f-string: Một cách mới và cải tiến để định dạng chuỗi ...
Hướng dẫn dùng python map python
Hàm map[] trả về đối tượng map [là một trình lặp] của các kết quả sau khi áp dụng hàm đã cho cho từng mục của một có thể lặp nhất định [danh ...
Hướng dẫn dùng sorted definition python
Xin chào mọi người. Ngôn ngữ lập trình Python 3 có sẵn 2 hàm sorted[] và sort[], vậy hôm nay chúng ta hãy cùng hiểu xem các hàm này hoạt động thế nào.Hàm ...
Hướng dẫn python inspect examples
Source code: Lib/inspect.pyThe inspect module provides several useful functions to help get information about live objects such as modules, classes, methods, functions, tracebacks, frame objects, and ...
Hướng dẫn dùng np.max index python
Nội dung chínhPython Numpy là gì?NumPy ArrayNumpy cài đặt như thế nào?Multi-dimensional numPy array là gì?Python NumPy Array v/s ListPython NumPy OperationsTham khảoPython Numpy là ...
Hướng dẫn dùng python squared python
Nhóm phát triển của chúng tôi vừa ra mắt website langlearning.net học tiếng Anh, Nga, Đức, Pháp, Việt, Trung, Hàn, Nhật, ... miễn phí cho tất cả mọi người. Là ...
How to avoid repetition in python
I have a problem with understanding of how to avoid #redundant repetition in for loops. This program intends to print the divisors of the number in the range 2 and number:number = int[input[Enter an ...
Hướng dẫn dùng python symbols python
In the following examples, input and output are distinguished by the presence or absence of prompts [>>> and …]: to repeat the example, you must type everything after the prompt, when the ...
Hướng dẫn dùng findall python python
Biểu thức chính quy là gì?Biểu thức chính quy trong ngôn ngữ lập trình là các chuỗi ký tự đặc biệt được dùng để mô tả một mẫu tìm kiếm. Nó cực kỳ ...
Hướng dẫn dùng pandas rounding python
Hàm round[] trong Python làm tròn x về n chữ số sau dấu thập phân. Python làm tròn theo cách sau: round[0.5] là 1.0 và round[-0.5] là -1.0Cú phápCú pháp của round[] trong ...
Hướng dẫn shuffle array javascript
Shuffle Array In placefunction shuffleArr [array]{ for [var i = array.length - 1; i > 0; i--] { var rand = Math.floor[Math.random[] * [i + 1]]; [array[i], array[rand]] = ...
Hướng dẫn operator in python
Nội dung chínhPhân loạiNhóm toán tử số họcNhóm toán tử logicToán tử quan hệNội dung chínhPhân loạiNhóm toán tử số họcNhóm toán tử logicToán tử quan ...
Hướng dẫn dùng pd.concat python
Trong chuỗi các bài học tiếp theo sẽ đề cập đến kĩ thuật merging dataframe. Xuất phát từ yêu cầu thực tế là chúng ta cần đọc dữ liệu tồn tại dưới ...
Hướng dẫn filter python
In this tutorial, we will learn about the Python filter[] function with the help of examples.Nội dung chínhfilter[] Syntaxfilter[] Argumentsfilter[] Return ValueExample 1: Working of ...
To học lập trình python pdf
Trong những năm gần đây, Python được nhắc đến như một ngôn ngữ lập trình ưu việt được ưa chuộng top đầu. Với người mới theo học Python, việc chọn ...
Hướng dẫn dùng removwe python
Hàm Set remove[] trong Python xóa phần tử được chỉ định từ một set.Nội dung chính2. Hàm set remove[] trong Python2. Ví dụ hàm set remove[] trong Python1. Hàm set remove[] ...
Hướng dẫn dùng array_contains trong PHP
Nội dung chính2. Mảng là gì? Mảng trong PHP là gì?2. Mảng chỉ số [Numeric Array] trong PHP3. Mảng kết hợp [Associative Array] trong PHP4. Mảng đa chiều trong PHP5. Sử ...
Hướng dẫn lệnh pop[] trong python
Hàm List pop[] trong Python xóa và trả về phần tử cuối cùng hoặc đối tượng obj có chỉ mục đã cung cấp từ list đã cho.Cú phápCú pháp của pop[] trong ...