15.02.2017 Views

Learning ArcGIS Pro

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Unfortunately, you cannot use this common method of defining a path within a Python<br />

script. Backslashes are reserved characters within Python that are used to indicate an<br />

escape or line continuation. So when specifying a data path, you must use a different<br />

method. Python supports three methods for defining a path:<br />

Double backslashes – C:\\Student\\IntroArc<strong>Pro</strong><br />

Single forward slash – C:/Student/IntroArc<strong>Pro</strong><br />

Single backslash with an r in front of it – rC:\Student\IntroArc<strong>Pro</strong><br />

You can use either of these methods when creating your own scripts. Although it is<br />

acceptable to use any of these within a single script, it is recommended you try to use the<br />

same method throughout the entire script. This will help you locate possible errors and fix<br />

them more quickly.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!