SORU
13 ŞUBAT 2011, Pazar


Nasıl bir dize unicode veya ascıı kontrol edebilirim?

Ben hangi kodlama anlamaya Python ne yapmam gerekiyor?

CEVAP
13 ŞUBAT 2011, Pazar


Python 3, Tüm dizeleri Unicode karakter dizisi. Ham bayt tutan bytes Bir tür var.

2, bir dize Python yazın str veya tip olabilir unicode. Şöyle bir şey: kod kullanarak söyleyemezsiniz

def whatisthis(s):
    if isinstance(s, str):
        print "ordinary string"
    elif isinstance(s, unicode):
        print "unicode string"
    else:
        print "not a string"

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

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Android Authority

    Android Auth

    3 NİSAN 2011
  • Chanre Joubert

    Chanre Joube

    27 Temmuz 2012
  • FOSDEM

    FOSDEM

    13 Ocak 2009