• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python argv.append函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: make_dists

def make_dists():
    prebuilt_platform_root = path.join("dtls", "prebuilt")
    for platform in listdir(prebuilt_platform_root):
        config = {"MANIFEST_DIR": path.join(prebuilt_platform_root, platform)}
        execfile(path.join(prebuilt_platform_root, platform, "manifest.pycfg"),
                 config)
        files = map(lambda x: "dtls/prebuilt/" + platform + "/" + x,
                    config["FILES"])
        argv.append("--formats=" + config["FORMATS"])
        invoke_setup([('dtls', files)])
        del argv[-1]
        for dist_format in config["FORMATS"].split(','):
            source_name = path.join(DIST_DIR,
                                    NAME + "-" + VERSION +
                                    FORMAT_TO_SUFFIX[dist_format])
            target_name = path.join(DIST_DIR,
                                    NAME + "-" + VERSION +
                                    ".sdist_with_openssl." +
                                    config["ARCHITECTURE"] +
                                    FORMAT_TO_SUFFIX[dist_format])
            try:
                remove(target_name)
            except OSError:
                pass
            rename(source_name, target_name)
    # Finally the distribution without prebuilts
    argv.append("--formats=zip,gztar")
    invoke_setup()
开发者ID:jvantuyl,项目名称:pydtls,代码行数:28,代码来源:setup.py


示例2: test_main_with_gui_argument

	def test_main_with_gui_argument(self):
		argv.append("-g")
		pacsudoku = main()
		with open(self.default_config_file) as rawfile:
			actual_xml_content = rawfile.readlines()
		self.assertEqual([], actual_xml_content)
		argv.pop()
		pacsudoku.config_file.file.close()
		remove(self.default_config_file)
开发者ID:pstuder,项目名称:pacsudoku,代码行数:9,代码来源:test_pacsudoku.py


示例3: test_main_with_valid_config_file

	def test_main_with_valid_config_file(self):
		argv.append("-c")
		argv.append(self.my_config_file)
		pacsudoku = main()
		with open(self.my_config_file) as rawfile:
			actual_xml_content = rawfile.readlines()
		self.assertEqual(self.expected_xml_content, actual_xml_content)
		argv.pop()
		argv.pop()
		pacsudoku.config_file_handler.file.close()
开发者ID:pstuder,项目名称:pacsudoku,代码行数:10,代码来源:test_pacsudoku.py


示例4: _parse_args

    def _parse_args(self):

        # display help per default:
        if len(argv) == 1:
            argv.append("-h")

        args = self.arg_parser.parse_args()
        self.args = args

        if args.verbose:
            logging.getLogger().setLevel(logging.INFO)
开发者ID:lpirl,项目名称:yana,代码行数:11,代码来源:cli.py


示例5: launch

def launch(module, includes ,files, out = None, multiple = None):
    import sys
    from sys import argv
    from copy import copy, deepcopy
    del argv[1:]
    argv.extend(default_defines)
    argv.extend(map(lambda include : '-I%s' % include, includes))
    argv.append('--module=%s' % module)
    if out == None:
        out = module
    argv.append('--out=%s' % out)
    if multiple:
        argv.append('--multiple')
    argv_saved = copy(argv)
    argv.extend(files)
    print argv


    from os import system

    def makecmd():
        import string
        return ('python -c "from Pyste import pyste; pyste.main()" ' 
            + string.join(argv[1:], ' '))
    
    system(makecmd())
    
    argv = argv_saved
    if multiple:
        argv.append('--generate-main')
        argv.extend(files)
        print 'generating main'
        system(makecmd())
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:33,代码来源:pyste_launcher.py


示例6: test_sudoku_argument_parser_class_with_arguments

	def test_sudoku_argument_parser_class_with_arguments(self):
		expected_config_metavar = "other.xml"
		argv.append("-g")
		argv.append("-c")
		argv.append(expected_config_metavar)
		parser = SudokuArgumentParser()
		actual_arguments = parser.parse_args()
		argv.pop()
		argv.pop()
		argv.pop()
		self.assertEqual(expected_config_metavar, actual_arguments.config)
		self.assertTrue(actual_arguments.gui)
开发者ID:pstuder,项目名称:pacsudoku,代码行数:12,代码来源:test_pacsudoku.py


示例7: print

from pyd.support import Extension
from pyd.support import setup
from pyd import patch_distutils
from sys import argv

if argv[-1] == "opt":
    print("building with optimalization")
    argv.pop()
    argv.append("build")
    argv.append("-c")
    argv.append("ldc2")
    argv.append("-O")

else: argv.append("build")



projName = 'dbindings'
sources = ['dbindings.d',
'ea/ea_config.d',
'ea/population.d',
'ea/individual.d',
'ea/beer_tracker_individual.d',
'ea/beer_tracker_population.d',
'flatland/flatland_agent.d',
'flatland/flatland_simulator.d',
'flatland/flatland_evolve.d',
'ann/ann.d',
'ann/matrix.d',
'ann/ann_config.d',
'ann/ctrnn.d',
开发者ID:iverasp,项目名称:it3708,代码行数:31,代码来源:setup.py


示例8: myhash

	inner_hash = myhash(s[1:])

	wat = s[0]
	return ((ord(wat)<<31)+(ord(wat)<<3)-(ord(wat)+1)+(inner_hash<<5)+(inner_hash>>5))&(0xffffffff)

def get_battery_level():
	level = -1
	try:
		with open("/sys/class/power_supply/BAT0/uevent","r") as f:
			uevent_contents = f.read()
			property_list = [tuple(x.split("=")) for x in uevent_contents.split("\n") if len(x.split("="))==2]
			properties = dict(property_list)
			level = int(properties['POWER_SUPPLY_CHARGE_NOW'])*100/int(properties['POWER_SUPPLY_CHARGE_FULL'])
	except Exception as e:
		level = -1
	return min(level,100)

if len(argv)<2:
	argv.append("test")

color = (myhash(argv[1]))%16
color_upper = int(color/8)
color_lower = int(color%8)

stdout.write("\033[%d;3%dm%s"%(color_upper,color_lower,argv[1]))
if argv[1]=="clamps": # Battery monitoring on laptop
	battery_level = get_battery_level()
	stdout.write("(%3d"%battery_level+"%%)") # percent signs are filtered by zsh


开发者ID:freedick,项目名称:dotfiles,代码行数:28,代码来源:colorgen.py


示例9: raise


        return 0
    except KeyboardInterrupt:
        ### handle keyboard interrupt ###
        return 0
    except Exception as e:
        if DEBUG:
            raise(e)
            pass
        indent = len(program_name) * " "
        from sys import stderr
        stderr.write(program_name + ": " + repr(e) + "\n")
        stderr.write(indent + "  for help use --help")
        return 2

    pass


if __name__ == "__main__":
    if DEBUG:
        from sys import argv
        argv.append("-n 700")
        argv.append("--minimizer=Powell")
        argv.append("--clf-params={'learning_rate': 0.05, 'min_child_weight': 240, 'subsample': 0.9, 'colsample_bytree': 0.67, 'max_depth': 6, 'initial_params': [0.1, -1, -2, -1, -0.8, 0.02, 0.8, 1]}")
        argv.append("-f 10")
        pass
    from sys import exit as Exit
    Exit(main())
    pass
开发者ID:ageek,项目名称:KAGGLE-prudential-life-insurance-assessment,代码行数:28,代码来源:XGB_offset_reg.py


示例10: looper

            self.close()
            os.system("gui_interaction.py restart")

    def looper(self):
        while True:
            time.sleep(1)
            self.updateSig.emit()

    def vaultlooper(self):
        while True:
            time.sleep(3)
            self.vaultSig.emit()


if __name__ == '__main__':
    argv.append("building")
    app = QApplication(argv)
    if "restart" not in argv and "building" not in argv:
        os.system("commands\\minimize.bat")
        ss = QSplashScreen(QPixmap("images/splash.png"))
        ss.show()
        ss.showMessage("Loading Components", alignment=Qt.AlignBottom|Qt.AlignHCenter, color=Qt.white)
        mp = gui_interaction()
        time.sleep(2)
        ss.showMessage("Initialising Components", alignment=Qt.AlignBottom|Qt.AlignHCenter, color=Qt.white)
        time.sleep(3)
        ss.showMessage("Finished Loading. Welcome to MagPy.", alignment=Qt.AlignBottom|Qt.AlignHCenter, color=Qt.white)
        time.sleep(1)
        mp.show()
        ss.hide()
    else:
开发者ID:projectmagpy,项目名称:MagPy,代码行数:31,代码来源:gui_interaction.py


示例11:

print "LISTE: impacchettamento, spacchettamento; accessibilita', inizializzazione tramite indicizzazione"

lista0 = [1, 4, 5]
print "Se si puo' impacchettare & accedere a una lista tramite indicizzazione, qui di seguito deve comparire il numero 4: ", lista0[1]

(pippo, pluto, paperino) = lista0
print "Se si puo' spacchettare una lista, qui di seguito deve comparire la serie 1 4 5: ", pippo, pluto, paperino

lista1 =[pippo, pluto, paperino]
lista1[0] =5
print "Se si puo' inizializzare una lista tramite indicizzazione, qui di seguito deve comparire una lista: ", lista1

print "\n-----------------------------------------------------------"
print "ARGV: qui testo se vari elementi visti finora sono o meno delle tuple"

argv.append(5)

print "Se sys.argv e' una lista, allora qui di seguito deve essere mostrata una lista contenente il nome dello script seguito dagli argomenti passati allo script e infine dal numero 5", argv

print "\n-----------------------------------------------------------"
print "DICTIONARY"

dic1 = {'a':1, 2:2, 'c':'a'}
key = 'c'
elem = dic1[key]
print "\nIl valore associato alla chiave \'%s\' e': " % key, elem
print "La seguente stampa del dizionario mostra come key e value possano essere insiemi eterogenei: ", dic1

dic2={'Panda':(1, 4), 5:'Foca'}
dic1['a']=dic2
print "La seguente stampa del dizionario mostra come i dizionari possano essere annidabili: ", dic1
开发者ID:vabite,项目名称:fight_the_snake,代码行数:31,代码来源:strutture_dati.py


示例12:

    #    help="snpEff output file", default=None)
    # grab options and arguments in an usable form
   

    #parser.add_option("-l", dest="log_file", 
    #    help="Optional log file", default=None)
    #parser.add_option("-o", dest="out_prefix", 
    #    help="Prefix for output files", default=None)
    
    parser.add_argument("-l", dest="log_file", 
        help="Optional log file", default=None)
    parser.add_argument("-o", dest="out_prefix", 
        help="Prefix for output files", default=None)
    
    if not argv[1:] :
       argv.append('-h')

    prog_name = os.path.basename(argv[0])
    args = parser.parse_args()
    #print options 
    
               
    if not args.vcf_file :
        parser.error("\nvcf file missing.")
    else :
        if not os.access(args.vcf_file, os.R_OK):
            parser.error("Unable to read vcf file %s " %args.vcf_file)
                
    if not args.out_prefix :
        out_snp   = args.vcf_file[:-4]+".snp"
        out_indel = args.vcf_file[:-4]+".indel"
开发者ID:avillain,项目名称:conversion,代码行数:31,代码来源:reformat_snpEff_for_SynTView.py


示例13: mode

#!/usr/bin/env python
import re
from sys import argv, stdout, stderr, exit, modules
from optparse import OptionParser

# import ROOT with a fix to get batch mode (http://root.cern.ch/phpBB3/viewtopic.php?t=3198)
argv.append("-b-")
import ROOT

ROOT.gROOT.SetBatch(True)
argv.remove("-b-")

from HiggsAnalysis.CombinedLimit.DatacardParser import *
from HiggsAnalysis.CombinedLimit.ModelTools import *
from HiggsAnalysis.CombinedLimit.ShapeTools import *
from HiggsAnalysis.CombinedLimit.PhysicsModel import *

parser = OptionParser(usage="usage: %prog [options] datacard.txt -o output \nrun with --help to get list of options")
addDatacardParserOptions(parser)
parser.add_option(
    "-P",
    "--physics-model",
    dest="physModel",
    default="HiggsAnalysis.CombinedLimit.PhysicsModel:defaultModel",
    type="string",
    help="Physics model to use. It should be in the form (module name):(object name)",
)
parser.add_option(
    "--PO",
    "--physics-option",
    dest="physOpt",
开发者ID:bispinck,项目名称:HiggsAnalysis-CombinedLimit,代码行数:31,代码来源:text2workspace.py


示例14: SupervisedDataSet

    samples = SupervisedDataSet(3,1)

    for i in data_transformed_training:
        samples.addSample(i['past'], i['next'] - i['average'])
    trainer = BackpropTrainer(net, samples)

    print 'Training'
    trainer.trainUntilConvergence(maxEpochs= 10)

    #Comparing step-------------------------------------------------------------------

    print 'Naive1'
    aux = map(lambda y: y['past'], data_transformed)
    aux2 = map(lambda y: y['next']-y['average'], data_transformed)
    compare_forecast_samples(Forecaster(predict_function = lambda x: aux2[aux.index(x)-1]), data_transformed)

    print 'Network'
    compare_forecast_samples(Forecaster(predict_function = net.activate), data_transformed)
    print "Number of samples %d for training." %len(data_transformed_training)

if __name__ == '__main__':
    from sys import argv
    if len(argv) < 2:
        '''Usage python %s [name_of_samples_file]''' %argv[0]
        argv.append('readings_27_04_12_15h22m53s.txt')
    print 'Working over', argv[1]

    #from pybrain.tools.shortcuts import buildNetWork
    
    main(argv[1])
开发者ID:labtempo,项目名称:TMON,代码行数:30,代码来源:teste3.py


示例15: getCompressionInfo

def getCompressionInfo(inputText,codeMap):
    ''' Return a Tuple containing the original number of bits, the final number of bits, and the compression ratio.'''
    codedSum=0
    for char in inputText:
        codedSum=codedSum+len(codeMap[char])
    startSize=len(inputText)*8
    endSize=codedSum
    ratio=float(startSize)/endSize
    return (startSize,endSize,ratio)

def printCodeInfo(inputText,codeMap):
    print 'Code Map:'
    printCode(codeMap)
    rawSize,compressedSize,ratio=getCompressionInfo(inputText,codeMap)
    print 'Original Size(bits):',rawSize,', Compressed Size(bits):',compressedSize,', Compression Ratio:',ratio

if(len(argv)>2):
    print 'expecting one argument'
    exit()
elif(len(argv)==1):
    argv.append('InputOutput.txt')

inputFile=open(argv[1],'r')
inputText=inputFile.read()

codeMap,codeTree=huffman.getCodeFromText(inputText)
huffmanCoder=huffman.HuffmanCoder(codeMap,codeTree)
pickleFile=open('huffmanCode','w')
pickle.dump(huffmanCoder,pickleFile)
pickleFile.close()
开发者ID:PawarPawan,项目名称:dqp,代码行数:30,代码来源:createCode.py


示例16: max

            lengths[1] = max(lengths[1], len(mote.getPort()))
            lengths[2] = max(lengths[2], len(mote.getName()))

        # Print header
        print ("{}  {}  {}".format("Reference".ljust(lengths[0]),
                                   "Port".ljust(lengths[1]),
                                   "Name".ljust(lengths[2])))

        # Print seperator
        print ("{}  {}  {}".format("".ljust(lengths[0], "-"),
                                   "".ljust(lengths[1], "-"),
                                   "".ljust(lengths[2], "-")))

        # Print motelist
        for mote in motelist:
            print ("{}  {}  {}".format(mote.getReference().ljust(lengths[0]),
                                       mote.getPort().ljust(lengths[1]),
                                       mote.getName().ljust(lengths[2])))

if __name__ == '__main__':
    if len(argv) == 1:
        argv.append("")

    if argv[1] == "-c":
        for x in Motelist.getMotelist(True):
            print (x.getCSVData())
    elif argv[1] == "-h":
        print ("Use motelist.py -c for CSV data.")
    else:
        Motelist.printMotelist()
开发者ID:atiselsts,项目名称:osw,代码行数:30,代码来源:motelist.py


示例17: item_details

def item_details(id_val):
  data = get("https://api.guildwars2.com/v2/items/{0}".format(id_val)).json()
  return { prop: data[prop] for prop in ["name", "description", "level", "rarity", "restrictions"] }

def item_prices(id_val):
  data = get("https://api.guildwars2.com/v2/commerce/prices/{0}".format(id_val)).json()
  return {
    "lowest_sell": data["sells"]["unit_price"],
    "highest_buy": data["buys"]["unit_price"]
  }

def copper_to_coins(copper, as_dict = False):
  coins = (copper // 10000, copper % 10000 // 100, copper % 100)
  if as_dict:
    return dict(zip(["gold", "silver", "copper"], coins))
  else:
    return coins


if __name__ == "__main__":
  if len(argv) < 2:
    argv.append(raw_input("Please enter an item's ID value or chat code: "))
  try:
    item_id = int(argv[1])
  except ValueError:
    item_id = chat_code_to_id(argv[1])
  prices = item_prices(item_id)
  print("Lowest sell: {}".format(copper_to_coins(prices["lowest_sell"])))
  print("Highest buy: {}".format(copper_to_coins(prices["highest_buy"])))
开发者ID:joeylmaalouf,项目名称:misc,代码行数:29,代码来源:gw2.py


示例18: len

import json
import datetime
from sys import argv
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

if len(argv) < 2:
    argv.append("config.json")
with open(argv[1]) as fp:
    data = json.load(fp)
driver = webdriver.Firefox()
driver.get("https://ezlmappdc1f.adp.com/ezLaborManagerNet/Login/Login.aspx")
try:
    assert "Client Login" in driver.title
    elem = driver.find_element_by_id("txtClientName")
    elem.send_keys(data["clientname"])
    elem.send_keys(Keys.ENTER)
except AssertionError:
    pass
assert "Login" in driver.title
elem = driver.find_element_by_id("txtUserID")
elem.send_keys(data["username"])
elem = driver.find_element_by_id("txtPassword")
elem.send_keys(data["password"])
elem.send_keys(Keys.ENTER)
assert "Home" in driver.title
driver.find_element_by_link_text("My Benefits").click()
elems = driver.find_elements_by_xpath('//*[@id="tableCurrentHolidays"]/tbody/tr/td[1]')
for elem in elems:
    print(datetime.datetime.strptime(elem.text, "%A, %B %d, %Y").date())
开发者ID:aquacash5,项目名称:ADP-Autologin,代码行数:30,代码来源:daysoff.py


示例19: Popen

from distutils.core import setup
from subprocess import Popen, PIPE
from sys import argv

# I would absolutely *LOVE* to be informed of a sexier way to do this,
# preferably without hard-coding Ubuntu as a special case...
try:
    if 'Ubuntu\n' in Popen(('lsb_release', '-si'),
            stdout=PIPE).communicate():
        argv.append('--install-layout=deb')
except OSError:
    pass



setup(name='ofed-le-utils',
      version='1.0.3',
      author='Amir Vadai',
      author_email='[email protected]',
      url='www.mellanox.co.il',
      scripts=['mlnx_qos', 'tc_wrap.py', 'mlnx_perf', 'mlnx_get_vfs.pl', 'mlnx_qcn'],
      py_modules=['netlink', 'dcbnetlink', 'genetlink'],
      )
开发者ID:Cai900205,项目名称:test,代码行数:23,代码来源:setup.py


示例20: join

            'TooFewKeywordSteps': (0,),
            'TooFewTestSteps': (0,),
            'TrailingBlankLines': (1,),
        }
        RfLint.__init__(self)
        user_rules = join(expanduser('~'), '.rflint.d')
        for user_rule in glob('%s/*.py' % user_rules):
            if user_rule.endswith('.__init__.py'):
                continue
            self._load_rule_file(user_rule)
        # pylint: disable=expression-not-assigned
        [rule.configure(*config[rule.name]) for rule in self.all_rules
         if rule.name in config.keys()]


def main(cli_args=None):
    """Lint all given Robot Framework data files."""
    response = -1
    try:
        response = RobotLint().run(cli_args)
    # pylint: disable=broad-except
    except Exception, e:
        stderr.write('%s\n' % str(e))
    return response


if __name__ == '__main__':
    if len(argv) == 1:
        argv.append('--help')
    exit(main(argv[1:]))
开发者ID:rickypc,项目名称:dotfiles,代码行数:30,代码来源:robot-lint.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python argv.index函数代码示例发布时间:2022-05-27
下一篇:
Python sys.sysexit函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap