本文整理汇总了后端语言Python中os.join方法的典型用法及代码示例,这里的代码示例可能为您提供帮助。也可以进一步了解该方法所在模块os
的用法示例。
如果想了解web前端内容,包括html,css,Javascript可以点击相关链接查看
# 需要导入模块: import os [as 别名] # 或者: from os import join [as 别名] def update(user, password, lang=None): langs = getlangs(lang) puts(u"Updating %s" % ‘, ‘.join(langs)) for loc in langs: with indent(2): puts(u"Downloading PO for %s" % loc) url = (u‘https://www.transifex.com/projects/p/formhub/‘ u‘resource/django/l/%(lang)s/download/for_use/‘ % {‘lang‘: loc}) try: tmp_po_file = download_with_login(url, TX_LOGIN_URL, login=user, password=password, ext=‘po‘, username_field=‘identification‘, password_field=‘password‘, form_id=1) po_file = os.path.join(REPO_ROOT, ‘locale‘, loc, ‘LC_MESSAGES‘, ‘django.po‘) with indent(2): puts(u"Copying downloaded file to %s" % po_file) shutil.move(tmp_po_file, po_file) except Exception as e: puts(colored.red(u"Unable to update %s " u"from Transifex: %r" % (loc, e))) puts(colored.green("sucesssfuly retrieved %s" % loc)) compile_mo(langs)
# 需要导入模块: import os [as 别名] # 或者: from os import join [as 别名] def saveGamepad(_settings): parser = SafeConfigParser() for controller_name in getSetting().getGamepadList(): gamepad = getSetting(controller_name) if not parser.has_section(controller_name): parser.add_section(controller_name) for key,value in gamepad.key_bindings.axis_bindings.iteritems(): neg,pos = value if not neg: neg = ‘none‘ if not pos: pos = ‘none‘ parser.set(controller_name,‘a‘+str(key),‘(‘+str(neg)+‘,‘+str(pos)+‘)‘ ) for key,value in gamepad.key_bindings.button_bindings.iteritems(): parser.set(controller_name,‘b‘+str(key),str(value)) with open(os.path.join(getSetting().datadir.replace(‘main.exe‘,‘‘),‘settings‘,‘gamepads.ini‘), ‘w‘) as configfile: parser.write(configfile)
原文:https://www.cnblogs.com/c68ychen/p/14232778.html