Найти - Пользователи
Полная версия: Запуск скрипта
Начало » Python для новичков » Запуск скрипта
1
Aldookar
Добрый вечер, помогите пожалуйста запустить скрипт…
Какая для него нужна версия 2.7 или 3.4?
init python:
    def unarchive(original_filename, new_filename):
        # original_filename is the name the file has when stored in the archive, including any 
        # leading paths.
        # new_filename is the name the file will have when extracted, relative to the base directory.
        
        import os
        import os.path
        new_filename = config.basedir + "/" + new_filename
        dirname = os.path.dirname(new_filename)
        
        if not os.path.exists(dirname):
            os.makedirs(dirname)
        orig = renpy.file(original_filename)
        new = open(new_filename, "wb")
        from shutil import copyfileobj
        copyfileobj(orig, new)
        new.close()
        orig.close()
        
            
label start:
    # We have Track01.mp3 in archive and images/photo.png in archive too
    
    # This will unarchive Track01.mp3 from archive basedir/extracted path
    $ unarchive("Track01.mp3", "extracted/Track01.mp3")
    
    # This will unarchive photo.png as xxx.png from archive to basedir/extracted path
    $ unarchive("images/photo.png", "extracted/xxx.png")
Aldookar
Спасибо разобрался….
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB