Skip to content
Advertisement

Joining pairs of elements of a list [duplicate]

This question already has answers here: How to iterate over a list in chunks (39 answers) Closed 8 months ago. I know that a list can be joined to make one long string as in: Obviously this would output: However, what I am trying to do is simply join the first and second strings in the list, then join the

Generating PDFs from SVG input

I am trying to generate a PDF from a SVG input file with Python in a Django application. I have already found 2 working solutions: cairo+rsvg and imagemagick but they both have one problem: They have some strange dependencies that I do not want to install on a server, for example DBUS and GTK. So I am asking for another

Pipe raw OpenCV images to FFmpeg

Here’s a fairly straightforward example of reading off a web cam using OpenCV’s python bindings: Now I want to pipe the output to ffmpeg as in: $ python capture.py | ffmpeg -f image2pipe -pix_fmt bgr8 -i – -s 640×480 foo.avi Sadly, I can’t get the ffmpeg magic incantation quite right and it fails with libavutil 50.15. 1 / 50.15. 1

Print Javascript Exceptions In A QWebView To The Console

I’m using PyQt4 and a QWebView widget to view a webpage, but it appears as though there is a problem with my Javascript. Other browsers seem to run ok, so I would like to know if any exceptions are occurring by printing them to the console. The code I’m using is below. What do I need to add to do

[] and {} vs list() and dict(), which is better? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 months ago. The community reviewed whether to reopen this question 6 months ago and left it closed: Original close reason(s) were not resolved Improve this question

extracting public key from certificate and encrypting data

This is for a homework assignment! I get the server’s certificate using get_peer_certificate() and the calling dump_certificate to dump the certificate in a variable. The format is PEM and looks right to me. How do I extract the server’s public key from this file (‘server.pubkey’) and encrypt plaintext using RSA algorithm and any python library. At the time of writing

List sorting/modify problem

Initially, I wasn’t sure whether this was the appropriate place for this question, but after reading through the FAQ I feel fairly confident the topic is acceptable…. Furthermore I wasn’t sure if this would be classified as a particular type of problem (eg. a knapsack problem), thus, the title is rather vague. I’m sorry for that. Anyways. As both practice

What’s an example use case for a Python classmethod?

I’ve read What are Class methods in Python for? but the examples in that post are complex. I am looking for a clear, simple, bare-bones example of a particular use case for classmethods in Python. Can you name a small, specific example use case where a Python classmethod would be the right tool for the job? Answer Helper methods for

Advertisement