当前位置: 首页>>代码示例>>Python>>正文


Python mylib.print_console函数代码示例

本文整理汇总了Python中mylib.print_console函数的典型用法代码示例。如果您正苦于以下问题:Python print_console函数的具体用法?Python print_console怎么用?Python print_console使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了print_console函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: compare_users

  def compare_users(self, user, user2):
    try:
      # comparison = self.api.get_user(user).compare_with_user(user2)

      user1_favs = self.api.get_user(user).get_top_artists('overall', 1000)
      user2_favs = self.api.get_user(user2).get_top_artists('overall', 1000)

    except pylast.WSError as e:
      print_console(LEL + " WSError %s: %s" % (e.status, e.details))
      exit(-1)

    n_artists1 = len(user1_favs)
    n_artists2 = len(user2_favs)

    user1_favs = [i.item.__str__() for i in user1_favs]
    user2_favs = [i.item.__str__() for i in user2_favs]

    intersection = [artist for artist in user1_favs if artist in user2_favs]
    artist_list = intersection[:5]

    comparison_index = round(200.0 * len(intersection) / (n_artists1 + n_artists2), 2)

    if comparison_index < 1.0:
      bar = PRETTY_BAR[4]
    else:
      bar = PRETTY_BAR[int(comparison_index / 25.01)]

    if artist_list:
      parsed_list = [str(item) for item in artist_list]
      chart_text = ", ".join(parsed_list)
    else:
      chart_text = "N/A"

    print_console(LEL + " Comparison: %s %s %s: Similarity: %d%% - Common Artists: %s" % (user, bar, user2, comparison_index, chart_text))
开发者ID:b0nk,项目名称:mbot-shell,代码行数:34,代码来源:lastfm.py

示例2: getBundle

def getBundle(b):
  charities = ["Electronic Frontier Foundation", "American Red Cross", "Child's Play Charity",
               "Mozilla Foundation", "CodeNow", "Maker Education Initiative",
               "Save the Children", "charity: water", "Exclusive Dreamcast T-Shirt",
               "AbleGamers", "Willow", "SpecialEffect",
               "GamesAid", "Girls Who Code", "The V Foundation",
               "buildOn", "The IndieCade Foundation", "Extra Life / Children's Miracle Network Hospitals",
               "Heifer International", "Comic Book Legal Defense Fund",
               "More games coming soon!", "More content coming soon!"]
  items = []

  if b is 'm':
    soup = bs4.BeautifulSoup(requests.get("https://humblebundle.com/mobile").text, "html.parser")
  elif b is 'b':
    soup = bs4.BeautifulSoup(requests.get("https://humblebundle.com/books").text, "html.parser")
  else:
    soup = bs4.BeautifulSoup(requests.get("https://humblebundle.com/").text, "html.parser")

  res = soup.find_all('span', 'game-box')

  if res:
    bTitle = soup.find('img', class_="promo-logo")['alt']
    for i in res:
      item = i.find('img')['alt']

      if item not in charities and "Soundtrack" not in item:
        items.append(item)

    print_console("07%s: %s" % (bTitle, ", ".join(items)))

  else:
    print_console("This bundle is over!")
开发者ID:xhip,项目名称:mbot-shell,代码行数:32,代码来源:humblebundle.py

示例3: init

def init():

  for feed in FEEDS:
    f = Feed(feed["id"], feed["logo"], feed["url"])
    print_console("Init %s" % f.feedid)
    f.mark_all_as_read()
    f.save()
  print_console("All unseen items marked as read.")
开发者ID:jruben84,项目名称:mbot-shell,代码行数:8,代码来源:rss3.py

示例4: degredo

def degredo():
    """Processo aleatorio"""

    request = requests.get('https://inquisicao.deadbsd.org/api/degredo', timeout=TIMEOUT)

    j = request.json()
    result = auto_de_fe(j)
    print_console(result)
开发者ID:b0nk,项目名称:mbot-shell,代码行数:8,代码来源:inquisicao.py

示例5: get_user_info

 def get_user_info(self, user):
   try:
     ui = self.api.get_user(user).get_info()
     
   except pylast.WSError as e:
     print_console(LEL + " WSError %s: %s" % (e.status,e.details))
     exit(-1)
   
   print_console(LEL + " Profile info for %s (%s, %s, %s) - Country: %s - Registered: %s - Play count: %s -- %s" % (ui['name'], ui['realname'], ui['age'], ui['gender'], ui['country'], ui['registered'], ui['playcount'], ui['url']))
开发者ID:punnie,项目名称:mbot-dongs,代码行数:9,代码来源:lastfm.py

示例6: save

  def save(self):
    try:
      f = open(FEEDFILE, "w+")
      obj = f
      pickle.dump(self.feeds, obj)
      f.close()

    except Exception as e:
      print_console(e)
开发者ID:b0nk,项目名称:mbot-shell,代码行数:9,代码来源:rss2.py

示例7: item

def item(feedid, n):
  exists = False
  for f in r.feeds:
    if r.feeds[f].feedid == feedid:
      exists = True
      r.feeds[f].get_item(n)
      r.save()
      
  if not exists:
    print_console("Feed %s doesn't exist! :(" % feedid)
开发者ID:b0nk,项目名称:mbot-shell,代码行数:10,代码来源:rss2.py

示例8: init

def init():

  if not os.path.exists("./rss-data"):
    os.makedirs("./rss-data")

  for feed in FEEDS:
    f = Feed(feed["id"], feed["logo"], feed["url"])
    print_console("Init %s" % f.feedid)
    f.mark_all_as_read()
    f.save()
  print_console("All unseen items marked as read.")
开发者ID:b0nk,项目名称:mbot-shell,代码行数:11,代码来源:rss3.py

示例9: item

def item(feedid, n):
  exists = False
  for feed in FEEDS:
    if feed["id"] == feedid:
      f = Feed(feed["id"], feed["logo"], feed["url"])
      exists = True
      f.get_item(n)
      f.save()

  if not exists:
    print_console("Feed %s doesn't exist! :(" % feedid)
开发者ID:b0nk,项目名称:mbot-shell,代码行数:11,代码来源:rss3.py

示例10: recent

def recent(feedid, n):
  exists = False
  for feed in FEEDS:
    if feed["id"] == feedid:
      f = Feed(feed["id"], feed["logo"], feed["url"])
      exists = True
      f.get_recent(n, mark_all_as_read=True)
      f.save()

  if not exists:
    print_console("Feed %s doesn't exist! :(" % feedid)
开发者ID:b0nk,项目名称:mbot-shell,代码行数:11,代码来源:rss3.py

示例11: recent

def recent(feedid, n):
  exists = False

  for f in r.feeds:
    if r.feeds[f].feedid == feedid:
      exists = True
      r.feeds[f].get_recent(n, mark_all_as_read = True)
      r.save()

  if not exists:
    print_console("Feed %s doesn't exist! :(" % feedid)
开发者ID:b0nk,项目名称:mbot-shell,代码行数:11,代码来源:rss2.py

示例12: load

 def load(self):
   try:
     f = open(FEEDFILE, "rb")
     obj = pickle.load(f)
     self.feeds = obj
     f.close()
   except IOError as e:
     if e.errno == 2: #ignore when file doesn't exist
       pass
       
   except Exception as e:
     print_console(e)
开发者ID:b0nk,项目名称:mbot-shell,代码行数:12,代码来源:rss2.py

示例13: reset

def reset(feedid):
  exists = False
  for feed in FEEDS:
    if feed["id"] == feedid:
      f = Feed(feed["id"], feed["logo"], feed["url"])
      exists = True
      f.entries = []
      f.save
      print_console("Cleared feed %s" % feedid)

  if not exists:
    print_console("Feed %s doesn't exist! :(" % feedid)
开发者ID:b0nk,项目名称:mbot-shell,代码行数:12,代码来源:rss3.py

示例14: reset

def reset(feedid):
  exists = False
  for f in r.feeds:
    if r.feeds[f].feedid == feedid:
      exists = True
      r.feeds[f].entries = []
      print_console("Cleared feed %s" % feedid)

  if not exists:
    print_console("Feed %s doesn't exist! :(" % feedid)
  else:
    r.save()
开发者ID:b0nk,项目名称:mbot-shell,代码行数:12,代码来源:rss2.py

示例15: ad_cautelam

def ad_cautelam(key, page):
    """Pesquisa em elementos de um Processo"""

    request = requests.get(
        'https://inquisicao.deadbsd.org/api/adcautelam?key=' + key +
        '&page=' + str(page), timeout=TIMEOUT)

    if request.status_code == 404:
        print_console("Not found")
    else:
        j = request.json()
        result = auto_de_fe(j, pesquisa=True)
        print_console(result)
开发者ID:b0nk,项目名称:mbot-shell,代码行数:13,代码来源:inquisicao.py


注:本文中的mylib.print_console函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。