This is an old copy of the Python FAQ. The information here may be outdated.

Tutor FAQ Suggestions

This page is used to collect entries for the new tutor FAQ. Post complete article entries below, and we’ll move them to separate pages as soon as possible (using a script). Pages that have been moved will appear on this page.

Markdown Syntax #

The PyFAQ site uses a markup syntax called “markdown” for both articles and comments.

To make an entry heading, start the line with “##” (e.g. ## title). E.g.

## How do I reverse a string ?

The easiest way to ...

    s = s[::-1]
    s = reversed(s)

For more on this, see <http://someurl>, where Guido writes:

> The slice syntax ...

As shown in the example, code snippets should be indented with four spaces, block quotes should be prefixed with > characters (just like in mail), paragraphs separated with at least one empty line, and URL:s enclosed in angle brackets.

For more on markdown syntax, see this page. If you want to experiment, you can use the markdown dingus demo site (but note that you can edit your comments if you make mistakes, so you can “experiment in place” if you prefer).

Ideas #

Here are some ideas for new entries, taken from posts by Mike Hansen and Ed Singleton.

  • How do I name an object based on user input?
  • How do I get an attribute of an object by name
  • How do I read the output from a program called via os.system()
  • Changing elements in a mutable object changes the object for all references

  • ord and chr

  • parsing html beautifulsoup
  • editors/ides
  • getters and setters
  • regex match and find
  • matrix operations
  • how do I make an exe out of a python script
  • books
  • what should I program?
  • unicode/encoding

If you have more ideas, post them below.


A Django site. rendered by a django application. hosted by webfaction.