# Python-字符串格式化

```str1 = 'good'
str2 = 'bye'```

`print str1 + str2`

```print 'very' + str1
print str1 + ' and ' + str2```

```num = 18
print 'My age is' + num```

`print 'My age is' + str(18)`

```num = 18
print 'My age is' + str(num)```

```num = 18
print 'My age is %d' % num```

`My age is 18`

`print ‘Price is %f’ % 4.99`

`Price is 4.990000`

`print ‘Price is %.2f’ % 4.99`

`Price is 4.99`

```name = 'Crossin'
print '%s is a good teacher.' % name```

`Crossin is a good teacher.`

`print 'Today is %s.' % 'Friday'`

`Today is Friday.`

THE END
{"ft_lang_label":"__label__zh","ft_lang_prob":0.7339386,"math_prob":0.9904872,"size":963,"snap":"2022-40-2023-06","text_gpt3_token_len":589,"char_repetition_ratio":0.14077164,"word_repetition_ratio":0.1,"special_character_ratio":0.31152648,"punctuation_ratio":0.07865169,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.96567476,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,4,null,4,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-10-05T15:52:54Z\",\"WARC-Record-ID\":\"<urn:uuid:c20cec47-e312-4baa-802f-67ac20841f4f>\",\"Content-Length\":\"58803\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:20c3beda-0f6f-4b8c-a050-be94688522f7>\",\"WARC-Concurrent-To\":\"<urn:uuid:180c35de-0bce-45c9-9458-e1a3f0c96b7e>\",\"WARC-IP-Address\":\"172.67.74.79\",\"WARC-Target-URI\":\"https://www.yfeer.com/157.html\",\"WARC-Payload-Digest\":\"sha1:EFIT3CMXGCX2YN77PZR6MFAWETWF3RKR\",\"WARC-Block-Digest\":\"sha1:ORBIH6RAPN6CMQZM5QT5VEEZR66327M4\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-40/CC-MAIN-2022-40_segments_1664030337631.84_warc_CC-MAIN-20221005140739-20221005170739-00548.warc.gz\"}"}