40923121

  • Home
    • Site Map
    • reveal
    • blog
  • About
  • Develop
  • 作業
    • 40923121 hw1
      • PCH7 Expansion Card Audio Video and Storage
      • Expansion Slots
      • PCI PCI X Slots
      • Summary
      • PCI Express  PCIe  Expansion Slots
      • AMR and CNR Slots
      • Overclocking
      • Choosing a Processor
      • CPU Cache
      • Video Output
      • Storage Devices  Optical Drives
      • Storage Devices  External Devices
      • Storage Devices  Legacy Devices
      • 擴展插槽
      • PCI   PCI-X插槽
      • 概要
      • PCI Express PCIe 擴展插槽
      • AMR和CNR插槽
      • 超頻
      • 選擇處理器
      • CPU緩存
      • 視頻輸出
      • 存儲設備 光盤驅動器
      • 存儲設備 外部設備
      • 存儲設備 舊版設備
      • Overview
      • Heat Sources
      • Heat Effects
      • Heat Reduction
      • Active Air Cooling
      • Passive Air Cooling
      • Liquid Cooling
      • CPU Cooling
      • Case Fans
      • Liquid Cooling Installation
      • 總覽
      • 熱源
      • 熱效應
      • 減少熱量
      • 主動風冷
      • 被動風冷
      • 液體冷卻
      • CPU散熱
      • 機箱風扇
      • 液體冷卻 安裝
    • hw2
    • hw3
      • Discussion-1
      • Sets
      • Features of sets
      • In Python
      • 討論區-1
      • 集的特徵
      • 在Python中
      • Discussion-2
      • More string things
      • Splitting strings
      • Joining strings
      • 討論區-2
      • 更弦的東西
      • 分割字符串
      • 連接字符串
      • Discussion-3
More string things << Previous Next >> Joining strings

Splitting strings

You can “split” or tear apart strings based on a given set of characters. For example:

  teststring = "this is a test"
  result = teststring.split("t")

And at the end, result will contain the list:

  ['', 'his is a ', 'es', '']

Instead of "t", you can write any character you want. If you do not include any character, it means “split on all whitespace”:

  teststring = "  this      has a lot    of   spaces and    tabs"
  result = testring.split()

Then result contains:

  ['this', 'has', 'a', 'lot', 'of', 'spaces', 'and', 'tabs']

More string things << Previous Next >> Joining strings

Copyright © All rights reserved | This template is made with by Colorlib