🐍 Python & Raspberry 🐍
8.19K subscribers
1.92K photos
125 videos
623 files
1.23K links
Python- Raspberry Pi-AI-IOT
ادمین : فرهاد ناصری زاده
@farhad_naserizadeh
@farhad3412

گروه پایتون
@Python_QA
تبادل
@mmtahmasbi
کانال مرتبط
@new_mathematical
@micropython_iot
@c_micro
اینستاگرام
http://Instagram.com/python_raspberry
Download Telegram
#آموزش

🔴 string formating
قسمت دوم


txt = "this is a testing example really is example....wow!!! this is really testing"
print(txt.replace('is', 'was'))
ouput : thwas was a testing example really was example....wow!!! thwas was really testing

print(txt.rfind('z'))
ouput : 64

print(txt.rfind('is', 10,63))
ouput : 59

print(txt.rindex('z'))
#id rindex cant find z give error but rfind give -1

print(txt.split())
ouput : ['this', 'is', 'a', 'testing', 'example', 'really', 'is', 'example....wow!!!', 'this', 'is', 'really', 'testing']

print(txt.split('i',2))
ouput : ['th', 's ', 's a testing example really is example....wow!!! this is really testing']

print(txt.split('i'))
['th', 's ', 's a test', 'ng example really ', 's example....wow!!! th', 's ', 's really test', 'ng']

txt = "this is \ntxting example....\nwow!!!"
print(txt.splitlines())
output : ['this is ', 'txting example....', 'wow!!!']

txt = "This Is txting Example....WOW!!!"
print(txt.swapcase())
output : tHIS iS TXTING eXAMPLE....wow!!!

txt = "tabriz"
print(txt.zfill(20))
output : '00000000000000tabriz'

print(r"how use \n without go to new line", end="\n\n")
output : how use \n without go to new line
#with end you can add somthing at end of string for example i add two new line

for i in range(4):
print(i, end=", ")

output : 0, 1, 2, 3


با تشکر از مهندس
@milad_ghasemi_1

❇️❇️ @raspberry_python