python

Django SocialAuth Fix Google Email Open id attribute exchange

2010
28
Apr

Django Social auth is a package that enables login to your django website with Facebook, Google, Yahoo and Twitter. Allowing authentication from 3rd party websites which supports open authentication helps users easy to register to your website without filling too much details. Easier signup makes more registrations and helps you cover your django web hosting charges Grinning . The package is managed at github here, but it does not have a stable release yet.

Read More

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)

Read More

Syndicate content