• pulbrich

    Or, if readability is not much of a concern:

    dict = {'12345':6, '01928':7}
    list = [1, 2, 3]
    
    found = [k for k in dict.keys() if set([int(aK) for aK in k]) >= set(list)]
    print(found) 
    

    posted in Pythonista read more
  • pulbrich

    dict = {'12345':6, '01928':7}
    list = [1, 2, 3]
    set_list = set(list)
    
    found = []
    for k in dict.keys():
      if set([int(aK) for aK in k]) >= set_list:
        found.append(k)
        
    print(found) 
    

    posted in Pythonista read more
  • pulbrich

    Try Think Python

    Though this is no video.

    posted in Pythonista read more
  • pulbrich

    @mikael Many, many thanks! Perfect now!

    posted in Pythonista read more
  • pulbrich

    I would go with @TPO ‘s idea, perfectly enough for the purpose.

    posted in Pythonista read more
  • pulbrich

    @mikael thanks for this, excellent. (If only it had a fuzzy search function... Just if you feel bored...)

    posted in Pythonista read more
  • pulbrich

    Have a look at the name attribute of your view instance. You can either set it at creation time with the name= parameter or later as myView.name = 'fancy'

    posted in General Discussion read more
  • pulbrich

    Put the following code to your sites packages folder and create a shortcut under the wrench tool.

    
    #Comment/Uncomment selected lines
    
    import editor
    
    text = editor.get_text()
    selection = editor.get_line_selection()
    selected_text = text[selection[0]:selection[1]]
    is_comment = selected_text.strip().startswith('#')
    replacement = ''
    for line in selected_text.splitlines():
        if is_comment:
            if line.strip().startswith('#'):
                replacement += line[line.find('#') + 1:] + '\n'
            else:
                replacement += line + '\n'
        else:
            replacement += '#' + line + '\n'
    
    editor.replace_text(selection[0], selection[1], replacement)
    editor.set_selection(selection[0], selection[0] + len(replacement) - 1)
    
    

    posted in Pythonista read more
  • pulbrich

    Both ddl and tbox are an instance of a class that are both subclasses of UIControl. Hence both ddl and tbox inherit from UIControl.

    posted in General Discussion read more
  • pulbrich

    @mikael Thanks for this, you awoke my interest and I started reading up on the topic. But I cannot (yet) contribute to the discussion.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!