Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wpforms-lite domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the businext domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the businext domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114
Python Nümerik Verileri String'e Dönüştürme - STR Function - RAGIP ÜNAL

Blog

Python Nümerik Verileri String’e Dönüştürme – STR Function

Ağırlıklı olarak bu durumla karşılaşırız. Bir sayı verisinin string türüne dönüştürüp kullanmak. Mesela  tcno=123456789, isim=”ragıp”, soyisim=”ünal” şeklindeki 3 ayrı veriyi calisanbilgi adında tek bir değişkende toplamak istersek aklımıza ilk olarak gelen çözüm, calisanbilgi=tcno+isim+soyisim atamasını yaparız.

>>> tcno=123456789
>>> isim="ragıp"
>>> soyisim="ünal"
>>> calisanbilgi=tcno+isim+soyisim
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    calisanbilgi=tcno+isim+soyisim
TypeError: unsupported operand type(s) for +: 'int' and 'str'

Bunun sebebi int türündeki tcno string türündeki isim ve soyisim eklenmek isteniyor. Bu mümkün olmadığını görüyoruz. Çözüm ise int türldeki tcno str donksiyonu ilse stringe dönüştürmektir. Şimdi aşağıdaki kodu uygulayalım.

>>> calisanbilgi=str(tcno)+isim+soyisim
>>> print(calisanbilgi)
123456789ragıpünal

Çıktıda da gördüğünüz gibi istediğimiz sonuç gerçekleşmiştir.

Leave A Comment

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir