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

  • Lamborghini

    Lamborghini

    13 Aralık 2005
  • parlophone

    parlophone

    28 ŞUBAT 2006
  • REK Roth Productions

    REK Roth Pro

    8 Ocak 2011