Skip to content

Instantly share code, notes, and snippets.

@jmwenda
Last active June 29, 2016 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmwenda/7805eacb21df64340a869beda6af895c to your computer and use it in GitHub Desktop.
Save jmwenda/7805eacb21df64340a869beda6af895c to your computer and use it in GitHub Desktop.
box[box.find("(")+1:box.find(")")]
>>> box = 'BOX(-71.1608660012332 42.3537910000038,-71.1237350012334 42.3727380000039)'
>>> print box
BOX(-71.1608660012332 42.3537910000038,-71.1237350012334 42.3727380000039)
>>> print box[s.find("(")+1:box.find(")")]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 's' is not defined
>>> print box[box.find("(")+1:box.find(")")]
-71.1608660012332 42.3537910000038,-71.1237350012334 42.3727380000039
>>> box = box[box.find("(")+1:box.find(")")]
>>> print box
-71.1608660012332 42.3537910000038,-71.1237350012334 42.3727380000039
>>> box_list = [x.strip() for x in box.split(',')]
>>> print box_list
['-71.1608660012332 42.3537910000038', '-71.1237350012334 42.3727380000039']
>>> minvalues = [x.strip() for x in box.split(' ')]
>>> print minvalues
['-71.1608660012332', '42.3537910000038,-71.1237350012334', '42.3727380000039']
>>> print box_list
['-71.1608660012332 42.3537910000038', '-71.1237350012334 42.3727380000039']
>>> minvalues = [x.strip() for x in box_list[0].split(' ')]
>>> print minvalues
['-71.1608660012332', '42.3537910000038']
>>> maxvalues = [x.strip() for x in box_list[1].split(' ')]
>>> print maxvalues
['-71.1237350012334', '42.3727380000039']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment