import os, re
config_file = "jsm_gyro_config.txt"
#fptr = open(config, "w")
#text = "demo text"
#fptr.write(text)
#fptr.close()
file = open(config_file, 'r')
file-read = file.read()
for line in file-read:
if re.search(userinput, file-read):
x = re.search(userinput, file-read)
# iteminputted is what the user wants to replace
iteminputted = "ref"
startpostion = x.span[1] + 3
endpostion = startposition + len(iteminputted)
# Find out how to write to a specific location in a file that will finish this off
else:
print("Item not found")
这就是我所尝试的,这是我的思考过程,因为任何帮助都会被告知,请让一个白痴理解:(
首先,您不应该在变量声明中使用
-
,因为它实际上是一个运算符,并且将始终被视为运算符。它将尝试减去下面是与固定和输入相同的代码
不过你的问题很不清楚,我已经尽力了
相关问题 更多 >
编程相关推荐