Push notification

This is the place for queries that don't fit in any of the other categories.

Push notification

Postby Nuber2Py » Wed Apr 16, 2014 7:57 pm

I am trying to follow the example at this location http://nthn.me/posts/2012/push.html and i did not understand what this line of code does

Code: Select all
fmt = '!cH32sH{0:d}s'.format(len(payload))

If anyone can please help me understand it I would really appreciate that.
Last edited by micseydel on Wed Apr 16, 2014 8:24 pm, edited 1 time in total.
Reason: Code tags, lock.
Posts: 1
Joined: Wed Apr 16, 2014 7:54 pm

Re: Push notification

Postby micseydel » Wed Apr 16, 2014 8:27 pm

It's just creating a format string for the struct.pack() call. The way he knew what the format string is should be documented somewhere by Apple.
Join the #python-forum IRC channel on irc.freenode.net for off-topic chat!

Please prefer not to PM members. The point of the forum is so that anyone can benefit. We don't want to help you over PMs/emails/Skype chats that others can't benefit from :)
User avatar
Posts: 2904
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Return to General Coding Help

Who is online

Users browsing this forum: Google [Bot] and 4 guests