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


Python HelperFunctions.downloadToFile方法代码示例

本文整理汇总了Python中HelperFunctions.downloadToFile方法的典型用法代码示例。如果您正苦于以下问题:Python HelperFunctions.downloadToFile方法的具体用法?Python HelperFunctions.downloadToFile怎么用?Python HelperFunctions.downloadToFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HelperFunctions的用法示例。


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

示例1: range

# 需要导入模块: import HelperFunctions [as 别名]
# 或者: from HelperFunctions import downloadToFile [as 别名]
    for d in range(1, 32):

        mon = "0" + str(m) if m < 10 else str(m)
        day = "0" + str(d) if d < 10 else str(d)

        try:
            os.mkdir("Devel/" + mon)
        except:
            pass

        try:
            os.mkdir("Usr/" + mon)
        except:
            pass

        fileName = mon + "/" + year + "-" + mon + "-" + day + ".txt"

        devUrl = devRoot + "/" + year + "/" + year + "-" + fileName
        usrUrl = usrRoot + "/" + year + "/" + year + "-" + fileName

        print("Dnld Devel... " + fileName)
        HF.downloadToFile(devUrl, "Devel/" + fileName)
        print("Dnld User... " + "Usr/" + fileName)
        HF.downloadToFile(usrUrl, "Usr/" + fileName)

    print("=======================================")


# Phew!!
print("All Done!")
开发者ID:Joisar,项目名称:Python-Scripts,代码行数:32,代码来源:Download+Logs.py

示例2: print

# 需要导入模块: import HelperFunctions [as 别名]
# 或者: from HelperFunctions import downloadToFile [as 别名]
for artist in os.listdir("G:\\Music\\#More"):
    if '#' not in artist:

        if os.path.isdir("G:\\Music\\#More\\" + artist):
            artistFolder = "G:\\Music\\#More\\" + artist
        else:
            continue

        # The file where lastfm response will be saved
        fileName = "Artists\\" + artist + " - Top " + limit + ".xml"

        print("Downloading File... " + artist)

        # Download to file
        params = urllib.parse.urlencode({'method': 'artist.gettoptracks', 'artist': artist, 'api_key': api_key, 'limit': limit})
        if (HelperFunctions.downloadToFile(root_url+params, fileName) == 0):
            print("Skipping... " + artist)
            print("=====================")
            continue

        # Build a parse tree
        tree = ET.parse(fileName).find("toptracks")

        # Output playlist file
        playlist = artistFolder + "\\" + artist + " - Top " + limit + ".m3u"
        op = open(playlist, "w")

        print("Building Playlist... " + artist)

        # Iter through the XML
        for item in tree.findall("track"):
开发者ID:Joisar,项目名称:Python-Scripts,代码行数:33,代码来源:TopTracks-All.py


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