title: api: how to get selected text from object sublime.Selection
body: <p>How to get selected text in <code>sublime text 3</code> plugin:</p>
  
  <pre><code>import sublime, sublime_plugin
  
  class plugin_window__go_to_relative_plugin__Command(sublime_plugin.WindowCommand):
      def run(self):            
          window = self.window
          view = window.active_view()
          sel = view.sel()
          sublime.status_message("selection: "+sel)
  </code></pre>
  
  <p>My code throws error:</p>
  
  <pre><code>     sublime.status_message("selection: "+sel)
  TypeError: Can't convert 'Selection' object to str implicitly
  </code></pre>
  
  <p><code>view.sel()</code> returns <code>sublime.Selection</code> object. But I don't know how to get selected text from there.</p>
  
  <p>This plugin must work as following:
  When I call it on view...</p>
  
  <p><img src="https://i.stack.imgur.com/hJjuX.png" alt="sublime text selection"></p>
  
  <p>... it should set text <code>"dow = self.w"</code> to variable <code>sel</code> </p>
  
  <p>When I do <code>str(sel)</code> it returns <code>&lt;sublime.Selection object at 0x1047fd8d0&gt;</code></p>
  
  <p><a href="http://www.sublimetext.com/docs/3/api_reference.html#sublime.Selection" rel="nofollow noreferrer">Docs</a> are not very clear for me.</p>