Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Please read: How to post Python code

$
0
0
Please try to post code in code blocks in the forums.

This is especially important with Python scripts, as indentation is part of the syntax!

Here's how:

Method 1:

(This is the method to use in the forum's "WYSIWYG mode")

1. Paste your code
2. Select your code
3. Click the "#" button in the interface

([CODE][/CODE] "tags" will be inserted before and after the selection.)

Method 2:

(This method is more suited for old-school types who edit posts in "Source mode".)

1. Enter: [CODE] [/CODE]
2. Paste your code in between [CODE] and [/CODE]

Your post (in "source mode") should look something like this:

[CODE]
try:
import arcpy
except:
print "Houston, we've had a problem."
raise
[/CODE]

Now, click the Preview Post button at the bottom of the page to make sure you did it right. Your code should display in a code block widget:

Code:

try:
    import arcpy
except:
    print "We have a problem"
    raise

For more details on ArcGIS forum post formatting using BB codes (including some not included as buttons in the forum's "WYSYWYG mode") with examples, visit the BB Code List page. The ArcGIS forum supports most, but not all, of these BB codes.

Thank you!

Viewing all articles
Browse latest Browse all 2485

Trending Articles