SORU
13 Kasım 2011, Pazar


Python boşluk üzerinde bir dize bölmek

Python eşdeğer arıyorum

String str = "many   fancy word \nhello    \thi";
String whiteSpaceRegex = "\\s";
String[] words = str.split(whiteSpaceRegex);

["many", "fancy", "word", "hello", "hi"]

CEVAP
13 Kasım 2011, Pazar


Bir bağımsız değişken olmadan str.split() yöntemi boşluk böler:

>>> "many   fancy word \nhello    \thi".split()
['many', 'fancy', 'word', 'hello', 'hi']

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Dave Wallace

    Dave Wallace

    27 Kasım 2007
  • GUN-TIME with Brandon

    GUN-TIME wit

    3 ŞUBAT 2009
  • Phymec

    Phymec

    18 Temmuz 2009