Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • use triple quotes """ """ if you want the string to span over multiple lines. Commented Jun 13, 2012 at 1:06
  • The answer below looks fine. For future reference, an api that takes a file will also work with a 'file-like object', see the StringIO module which can be used to make a string that can be read as if it were a file. Commented Jun 13, 2012 at 1:12