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

  • Ayite Atiwoto (superjiffrey)

    Ayite Atiwot

    29 EYLÜL 2010
  • ODN

    ODN

    26 Kasım 2006
  • Submissions101

    Submissions1

    23 ŞUBAT 2007