Python không có kiểu dữ liệu ký tự, một ký tự đơn giản chỉ là một chuỗi có độ dài là 1. Dấu ngoặc vuông có thể được sử dụng để truy cập các phần tử của chuỗi
Python3
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks6
A Computer Science portal for geeks7
đầu ra
A Computer Science portal for geeks
Tạo chuỗi trong Python
Các chuỗi trong Python có thể được tạo bằng cách sử dụng dấu ngoặc đơn hoặc dấu ngoặc kép hoặc thậm chí là dấu ngoặc kép.
Python3
A Computer Science portal for geeks8
A Computer Science portal for geeks9
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life1
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life2
________ 73 ________ 74 ________ 75
A Computer Science portal for geeks4
A Computer Science portal for geeks5
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life8
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life1
A Computer Science portal for geeks84
________ 73 ________ 74 ________ 187
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks70
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life1
A Computer Science portal for geeks76
________ 73 ________ 74 ________ 279
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks72
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks77
A Computer Science portal for geeks78
________ 73 ________ 74 ________ 481
_______482____483
A Computer Science portal for geeks82
A Computer Science portal for geeks85
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks88
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
đầu ra.
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life
Truy cập các ký tự trong Chuỗi Python
Trong Python, có thể truy cập các ký tự riêng lẻ của Chuỗi bằng cách sử dụng phương thức Lập chỉ mục. Lập chỉ mục cho phép các tham chiếu địa chỉ phủ định truy cập các ký tự từ phía sau Chuỗi, e. g. -1 đề cập đến ký tự cuối cùng, -2 đề cập đến ký tự cuối cùng thứ hai, v.v.
Khi truy cập một chỉ mục ngoài phạm vi sẽ gây ra lỗi IndexError. Chỉ các Số nguyên mới được phép chuyển dưới dạng chỉ mục, số float hoặc các loại khác sẽ gây ra TypeError
Python3
A Computer Science portal for geeks02
A Computer Science portal for geeks03
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
________ 73 ________ 74 ________ 607
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks80
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks85
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks88
A Computer Science portal for geeks7
A Computer Science portal for geeks4
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life91____792
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life93
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life95
A Computer Science portal for geeks4
A Computer Science portal for geeks5
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life98
A Computer Science portal for geeks7
A Computer Science portal for geeks4
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life91____002
A Computer Science portal for geeks03
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life93
đầu ra.
A Computer Science portal for geeks8
Đảo ngược chuỗi Python
Với Truy cập các ký tự từ một chuỗi, chúng ta cũng có thể đảo ngược chúng. Chúng ta có thể Đảo ngược một chuỗi bằng cách viết [. -1] và chuỗi sẽ bị đảo ngược
Python3
A Computer Science portal for geeks05
________ 006 ________ 74 ________ 008
A Computer Science portal for geeks4
A Computer Science portal for geeks10
A Computer Science portal for geeks02
A Computer Science portal for geeks03
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life93
đầu ra
A Computer Science portal for geeks7
Chúng ta cũng có thể đảo ngược một chuỗi bằng cách sử dụng hàm nối và đảo ngược tích hợp
Python3
A Computer Science portal for geeks14
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
________ 006 ________ 74 ________ 008
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks20
A Computer Science portal for geeks06
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life4
A Computer Science portal for geeks23
A Computer Science portal for geeks24
A Computer Science portal for geeks25
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks4
A Computer Science portal for geeks28
đầu ra
A Computer Science portal for geeks7
cắt chuỗi
Để truy cập một dãy ký tự trong String, phương pháp cắt lát được sử dụng. Việc cắt trong Chuỗi được thực hiện bằng cách sử dụng toán tử Cắt [dấu hai chấm].
Python3
A Computer Science portal for geeks29
A Computer Science portal for geeks30
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life1
________ 73 ________ 74 ________ 607
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks80
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks43
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks46
A Computer Science portal for geeks7
A Computer Science portal for geeks4
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life91____050______051
A Computer Science portal for geeks52
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life93
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks55
A Computer Science portal for geeks56
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks59
A Computer Science portal for geeks60
________ 061 ________ 062 ________ 07
A Computer Science portal for geeks4
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life91____050
A Computer Science portal for geeks51
A Computer Science portal for geeks02
A Computer Science portal for geeks69
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life93
đầu ra.
A Computer Science portal for geeks8
Xóa/Cập nhật từ Chuỗi
Trong Python, không được phép cập nhật hoặc xóa các ký tự khỏi Chuỗi. Điều này sẽ gây ra lỗi vì không hỗ trợ gán mục hoặc xóa mục khỏi Chuỗi. Mặc dù có thể xóa toàn bộ Chuỗi bằng cách sử dụng từ khóa del tích hợp. Điều này là do Chuỗi là bất biến, do đó các phần tử của Chuỗi không thể thay đổi sau khi được gán. Chỉ các chuỗi mới có thể được gán lại cho cùng một tên.
Cập nhật nhân vật.
Python3
A Computer Science portal for geeks71
A Computer Science portal for geeks72
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
________ 73 ________ 74 ________ 076
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks80
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks84
A Computer Science portal for geeks85
A Computer Science portal for geeks86
A Computer Science portal for geeks87
A Computer Science portal for geeks88
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life4
A Computer Science portal for geeks90____181
A Computer Science portal for geeks92______069______094
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life4
A Computer Science portal for geeks96
________ 097 ________ 74 ________ 099
A Computer Science portal for geeks4
A Computer Science portal for geeks5
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life02
A Computer Science portal for geeks7
A Computer Science portal for geeks4
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life05
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life07
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life08
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life4
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life10_______792
A Computer Science portal for geeks51
A Computer Science portal for geeks69
A Computer Science portal for geeks94
A Computer Science portal for geeks60
A Computer Science portal for geeks96
A Computer Science portal for geeks60
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life10
A Computer Science portal for geeks50
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life20
A Computer Science portal for geeks4
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life22
Lỗi.
Traceback [cuộc gọi gần đây nhất gần đây nhất].
Tệp “/home/360bb1830c83a918fc78aa8979195653. py”, dòng 10, trong
String1[2] = ‘p’
TypeError. đối tượng ‘str’ không hỗ trợ gán mục
Cập nhật toàn bộ chuỗi
Python3
A Computer Science portal for geeks71
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life24
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
________ 73 ________ 74 ________ 076
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks80
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life36
________ 73 ________ 74 ________ 739
A Computer Science portal for geeks4
A Computer Science portal for geeks5
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life42
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
đầu ra.
A Computer Science portal for geeks0
Xóa một ký tự.
Python3
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life46
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life47
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
________ 73 ________ 74 ________ 076
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks80
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life59
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life60
A Computer Science portal for geeks97
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life4
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life10
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life92
A Computer Science portal for geeks51
A Computer Science portal for geeks69
A Computer Science portal for geeks94
A Computer Science portal for geeks60
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life10
A Computer Science portal for geeks50
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life20
A Computer Science portal for geeks4
A Computer Science portal for geeks5
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life74
A Computer Science portal for geeks7
A Computer Science portal for geeks4
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life05
Lỗi.
Chuỗi ban đầu.
Xin chào, tôi là người lập dịXóa ký tự ở Chỉ mục thứ 2.
Trợ giúp, tôi là một người lập dị
Xóa toàn bộ chuỗi
Có thể xóa toàn bộ chuỗi bằng cách sử dụng từ khóa del. Hơn nữa, nếu chúng ta cố in chuỗi, điều này sẽ tạo ra lỗi vì Chuỗi đã bị xóa và không thể in được.
Python3
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life46
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life24
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
________ 73 ________ 74 ________ 076
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks80
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life91
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life92
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life93
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life3
A Computer Science portal for geeks4
A Computer Science portal for geeks5
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life97
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
Lỗi.
Traceback [cuộc gọi gần đây nhất gần đây nhất].
Tệp “/home/e4b8f2170f140da99d2fe57d9d8c6a94. py”, dòng 12, trong
print[String1]
NameError. tên 'String1' không được xác định
Trình tự thoát trong Python
Trong khi in Chuỗi có dấu ngoặc đơn và dấu ngoặc kép, nó gây ra SyntaxError vì Chuỗi đã chứa Dấu ngoặc đơn và Dấu ngoặc kép và do đó không thể in được bằng cách sử dụng một trong hai dấu ngoặc kép này. Do đó, để in một Chuỗi như vậy, hãy sử dụng Dấu ngoặc kép hoặc chuỗi Escape được sử dụng để in các Chuỗi đó.
Chuỗi thoát bắt đầu bằng dấu gạch chéo ngược và có thể được hiểu theo cách khác. Nếu các dấu ngoặc đơn được sử dụng để biểu diễn một chuỗi, thì tất cả các dấu nháy đơn có trong chuỗi phải được thoát và điều tương tự cũng được thực hiện đối với Dấu ngoặc kép.
Python3
A Computer Science portal for geeks8
A Computer Science portal for geeks802
A Computer Science portal for geeks803
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks805
________ 73 ________ 74 ________ 1808
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks811
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks816
________ 73 ________ 74 ________ 1819
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks822
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks827
________ 73 ________ 74 ________ 1830
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks833
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks838
A Computer Science portal for geeks839
________ 73 ________ 74 ________ 1842
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks845
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks838
A Computer Science portal for geeks851
________ 73 ________ 74 ________ 1854
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks857
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks838
A Computer Science portal for geeks863
________ 73 ________ 74 ________ 1866
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks869
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
đầu ra
A Computer Science portal for geeks8
Để bỏ qua các chuỗi thoát trong Chuỗi, r hoặc R được sử dụng, điều này ngụ ý rằng chuỗi là một chuỗi thô và các chuỗi thoát bên trong nó sẽ bị bỏ qua
Python3
A Computer Science portal for geeks873
________ 73 ________ 74 ________ 1876
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks879
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks884
A Computer Science portal for geeks885
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life3
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life4
A Computer Science portal for geeks888
A Computer Science portal for geeks889
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks892
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks897
________ 73 ________ 74 ________ 2700
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks703
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks884
A Computer Science portal for geeks885
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life3______74
A Computer Science portal for geeks888
A Computer Science portal for geeks700
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks716
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
đầu ra
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life9
Định dạng chuỗi
Các chuỗi trong Python có thể được định dạng bằng cách sử dụng phương thức format[], đây là một công cụ rất linh hoạt và mạnh mẽ để định dạng Chuỗi. Phương thức định dạng trong Chuỗi chứa dấu ngoặc nhọn {} làm trình giữ chỗ có thể giữ đối số theo vị trí hoặc từ khóa để chỉ định thứ tự
Python3
A Computer Science portal for geeks8
A Computer Science portal for geeks721
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks723
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life3
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life4
A Computer Science portal for geeks726
A Computer Science portal for geeks727
A Computer Science portal for geeks728
A Computer Science portal for geeks5
A Computer Science portal for geeks730
A Computer Science portal for geeks731
A Computer Science portal for geeks732
A Computer Science portal for geeks731
A Computer Science portal for geeks734
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks738
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks743
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life3
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life4
A Computer Science portal for geeks746
A Computer Science portal for geeks727
A Computer Science portal for geeks728
A Computer Science portal for geeks5
A Computer Science portal for geeks730
A Computer Science portal for geeks731
A Computer Science portal for geeks732
A Computer Science portal for geeks731
A Computer Science portal for geeks734
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks758
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks763
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life3
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life4
A Computer Science portal for geeks766
A Computer Science portal for geeks727
A Computer Science portal for geeks728
A Computer Science portal for geeks769
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life4
A Computer Science portal for geeks730
A Computer Science portal for geeks772
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life4
A Computer Science portal for geeks732
A Computer Science portal for geeks775
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life4
A Computer Science portal for geeks734
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks781
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
đầu ra.
A Computer Science portal for geeks0
Các số nguyên như nhị phân, thập lục phân, v.v. và số float có thể được làm tròn hoặc hiển thị ở dạng số mũ bằng cách sử dụng định dạng định dạng.
Python3
A Computer Science portal for geeks785
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life3
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life4
A Computer Science portal for geeks788
A Computer Science portal for geeks727
A Computer Science portal for geeks728
A Computer Science portal for geeks5
A Computer Science portal for geeks792
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks796
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks701
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life3
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life4
A Computer Science portal for geeks704
A Computer Science portal for geeks727
A Computer Science portal for geeks728
A Computer Science portal for geeks5
A Computer Science portal for geeks708
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks712
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life0
A Computer Science portal for geeks717
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life3
String with the use of Single Quotes: Welcome to the Geeks World String with the use of Double Quotes: I'm a Geek String with the use of Triple Quotes: I'm a Geek and I live in a world of "Geeks" Creating a multiline String: Geeks For Life4
A Computer Science portal for geeks720
A Computer Science portal for geeks727
A Computer Science portal for geeks728
A Computer Science portal for geeks5
A Computer Science portal for geeks03
A Computer Science portal for geeks725
A Computer Science portal for geeks726
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks5
A Computer Science portal for geeks730
A Computer Science portal for geeks7
A Computer Science portal for geeks4
A Computer Science portal for geeks81
đầu ra.
A Computer Science portal for geeks1
Một chuỗi có thể được căn trái[] hoặc căn giữa[^] bằng cách sử dụng các chỉ định định dạng, được phân tách bằng dấu hai chấm [. ].