python学习笔记之字符串

字符串格式化:
format = “hello %s, %s enough for ya?”
values = (‘world’,’hot’)
print format % values
结果:hello world, hot enough for ya?
注:如果不是在命令行执行,把print后面的用括号括起来

与php类似但函数或方法名不一样的地方:
php explode=> python split
php trim => python strip
php implode => python join

This entry was posted in python. Bookmark the permalink.

One Response to python学习笔记之字符串

  1. 足梦 says:

    程序看着都是晕晕的

Leave a Reply

Your email address will not be published. Required fields are marked *

*