Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf7dbba5

Browse files
committed
add splitting text tutorial
1 parente6e60b8 commitf7dbba5

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ This is a repository of all the tutorials of [The Python Code](https://www.thepy
162162
-[How to Delete Emails in Python](https://www.thepythoncode.com/article/deleting-emails-in-python). ([code](python-standard-library/deleting-emails))
163163
-[Daemon Threads in Python](https://www.thepythoncode.com/article/daemon-threads-in-python). ([code](python-standard-library/daemon-thread))
164164
-[How to Organize Files by Extension in Python](https://www.thepythoncode.com/article/organize-files-by-extension-with-python). ([code](python-standard-library/extension-separator))
165+
-[How to Split a String In Python](https://www.thepythoncode.com/article/split-a-string-in-python). ([code](python-standard-library/split-string))
165166

166167
-###[Using APIs](https://www.thepythoncode.com/topic/using-apis-in-python)
167168
-[How to Automate your VPS or Dedicated Server Management in Python](https://www.thepythoncode.com/article/automate-veesp-server-management-in-python). ([code](general/automating-server-management))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#[How to Split a String In Python](https://www.thepythoncode.com/article/split-a-string-in-python)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#Declare Two Variables
2+
variable1="Splitting a string"
3+
variable2='Splitting another string'
4+
5+
#Splitting The Variables
6+
print(variable1.split())
7+
print(variable2.split())
8+
9+
#Splitting The Variables
10+
print(variable1.split())
11+
print(variable2.split(","))
12+
13+
#Declare Two Variables
14+
variable1="Splitting*a*string"
15+
variable2='Splitting,another,string'
16+
#Splitting The Variables
17+
print(variable1.split("*"))
18+
print(variable2.split(","))
19+
20+
#Splitting The Variables
21+
print(variable1.split("*")[2])
22+
print(variable2.split(",")[0])
23+
24+
#Declare The Variable
25+
variable="Splitting a string"
26+
#Use The Maxsplit
27+
print(variable.split(" ",maxsplit=1))
28+
29+
#Declare The Variable
30+
variable="Splitting a string"
31+
#Split The String By Characters
32+
print(list(variable))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp