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


Python String.trim方法代码示例

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


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

示例1: parameterScan

# 需要导入模块: from java.lang import String [as 别名]
# 或者: from java.lang.String import trim [as 别名]
def parameterScan():
	global scan_device_server_name	
	global scan_1d_front
	global scan_2d_front
	global path 
	global data_file 
	global file_extension 
	global actuators
	global sensors 
	global n_steps 
	global integration_time 
	global start_position_actuators_1D 
	global end_position_actuators_1D 
	global n_steps2 
	global start_position_actuators_2D 
	global end_position_actuators_2D 
	global timebase 
	global scan_number 
	global scan_type 
	global has_trajectory	
	global file_path
	global actuators2D
	#open the file in read only mode
	#file = DataInputStream(FileInputStream("D:\eclipse\workspace\passerelle-soleil\sample-models\paramscan.txt"))
	file =  open(file_path,'r')
	parameters = {}
	for line in file.readlines():
		#print "line ",line
		tokens = line.split('=')
		#print "tokens ",tokens
		if(len(tokens) == 2):
			tok0 = String(tokens[0])
			tok1 = String(tokens[1])
			tok0 = tok0.trim()
			tok1 = tok1.trim()
			parameters[tok0] = tok1
			print tok0,":",tok1
	
	if(parameters.has_key("scan_device_server_name")):
		scan_device_server_name = parameters["scan_device_server_name"]
		
	if(parameters.has_key("scan_1d_front")):
		scan_1d_front = parameters["scan_1d_front"]
		
	if(parameters.has_key("scan_2d_front")):
		scan_2d_front = parameters["scan_2d_front"]
	
	if(parameters.has_key("path")):
		path = parameters["path"]
	
	if(parameters.has_key("data_file")):
		data_file = parameters["data_file"]
	
	if(parameters.has_key("file_extension")):
		file_extension = parameters["file_extension"]
	
	if(parameters.has_key("actuators")):
		actuators = parameters["actuators"].split(",")
		#print  "parameterScan actuators ",parameters["actuators"].split(",")
   	
   	if(parameters.has_key("sensors")):
		sensors = parameters["sensors"].split(",")
  	
  	#if(parameters.has_key("n_steps")):
		#n_steps = Integer.parseInt(parameters["n_steps"])
   	
   	#if(parameters.has_key("integration_time")):
		#integration_time = Double.parseDouble(parameters["integration_time"])
	
	#if(parameters.has_key("start_position_actuators_1D")):	
	#	stringTable = parameters["start_position_actuators_1D"].split(",")
	#	start_position_actuators_1D = []
	#	for i in stringTable:
	#		start_position_actuators_1D.append(Double.parseDouble(i))
   	
   	if(parameters.has_key("end_position_actuators_1D")):
		stringTable = parameters["end_position_actuators_1D"].split(",")
		end_position_actuators_1D = []
		for i in stringTable:
			end_position_actuators_1D.append(Double.parseDouble(i))
	
	if(parameters.has_key("actuators2D")):
		actuators2D = parameters["actuators2D"].split(",")
		#print  "parameterScan actuators ",parameters["actuators"].split(",")
	
	if(parameters.has_key("n_steps2")):
		n_steps2 = Integer.parseInt(parameters["n_steps2"])
	
	if(parameters.has_key("start_position_actuators_2D")):	
		stringTable = parameters["start_position_actuators_2D"].split(",")
		start_position_actuators_2D = []
		for i in stringTable:
			start_position_actuators_2D.append(Double.parseDouble(i))
   	
   	if(parameters.has_key("end_position_actuators_2D")):
		stringTable = parameters["end_position_actuators_2D"].split(",")
		end_position_actuators_2D = []
		for i in stringTable:
			end_position_actuators_2D.append(Double.parseDouble(i))
   	
#.........这里部分代码省略.........
开发者ID:thiyagavit,项目名称:passerelle,代码行数:103,代码来源:scan_1d.py


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