Sprintf Function in Python
2010
21
Mar
The printf or sprintf function is used to format strings in PHP and C programming constructs. sprintf in php returns the formatted string whereas printf just prints the output.
$variable = sprintf("%d %s %d = %d",4,"+",5,9); print $variable; //OR printf("%d %s %d = %d",4,"+",5,9); //Both lines are identical. //Prints 4 + 5 = 9
On python, sprintf is handled using an operator instead of function. The % operator on a string does formatting.
var = '%d %s %d = %d' % (4,'+',5,9)
The above code assigns var = "4 + 5 = 9"
Install Python for Nokia E63 / E71 compatible symbian phones and code on the move
Python rocks
Similar Posts
Related Searches
- Python Django Web Hosting
- Php Gzdecode Function
- Battery Care Function Vaio Windows7
- Host File Write Permission Denied
- Sony Vaio Cw Hard Disk Partition
- Sony Dsc H20 Firmware Hack
- Working Sms Script
- Php Page Scrape Facebook
- Cannon Sx120is Windows 7 Driver
- Www Mechanize Resume On Error
- Sony Vaio Car Adapter
- Hdmi Cable Sony Vaio

Comments
Post new comment