ページへ戻る

− Links

 印刷 

Python​/文字列の分割 の変更点 :: NJF Wiki

xpwiki:Python/文字列の分割 の変更点

« Prev[3]  
3: 2017-09-04 (月) 08:19:46 njf[4] ソース[5] バックアップ No.3 を復元して編集[6] 現: 2017-09-05 (火) 14:40:09 njf[4] ソース[7] 編集[8]
Line 3: Line 3:
 testStr = "a,b,c,d,e,f"  testStr = "a,b,c,d,e,f"
 + 
 print testStr.split(",")  print testStr.split(",")
Line 13: Line 13:
 testStr = "a,b,c,d,e,f"  testStr = "a,b,c,d,e,f"
 + 
 print testStr.split(",",2)  print testStr.split(",",2)
Line 26: Line 26:
 testStr = "123456789"  testStr = "123456789"
 + 
 print list(testStr)  print list(testStr)
Line 37: Line 37:
 testStr = "123456789"  testStr = "123456789"
 + 
 for c in testStr:  for c in testStr:
     print c      print c
Line 52: Line 52:
 9  9
-しかし、頻繁に大きな文字列を編集するならリストの方が高速なので、その場合に役立つことがあります。+しかし、頻繁に大きな文字列を編集するならリストの方が高速なので、その場合に文字列のリストへの変換が役立つことがあります。
« Prev[3]