Professional IronPython



Download 20,35 Mb.
Pdf ko'rish
bet105/453
Sana01.07.2022
Hajmi20,35 Mb.
#723045
1   ...   101   102   103   104   105   106   107   108   ...   453
upper()
: Returns the uppercase version of the string.
548592c05.indd 82
2/24/10 1:21:47 PM
www.finebook.ir


Working with Existing Objects
 

 
83


zfill(int width)
: Returns a string that has zeros placed on the left side to pad the string 
to the length specified by width. For example, if you typed 
MyString.zfill(40)
, you’d 
receive a string that is 40 characters long with as many zeros on the left side as required to 
produce the required length.
Formatting String Output
String formatting can become quite complex in Python and IronPython. However, if you start with 
the basics, you’ll find that you can usually figure out the complex elements without too much trouble. 
A basic format string contains one or more fields. A field is simply some text that appears within curly 
braces that you replace with a value. In fact, if you’ve worked with any .NET language, you’ve already 
used fields. Here’s a simple sentence that contains a field.
MyString = ‘Hello {0}‘
Of course, you won’t want to print this string directly onscreen. Instead, you’ll want to replace 
{0}
with some other value. In order to do this, you can use the 
format()
method as shown here.
MyString.format(‘George’)
The interpreter replaces the 
{0}
with the name 
George
. Consequently, you see ‘Hello George’ as 
output from these two lines of code. You have a number of options when working with replaceable 
variables in a string. The following list shows just a few of the options:
➤➤
MyString = ‘Hello {0}‘
: Provides a simple replacement from a list of input arguments. 
The input arguments must appear in the order required in the string.



Download 20,35 Mb.

Do'stlaringiz bilan baham:
1   ...   101   102   103   104   105   106   107   108   ...   453




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish