比如我有一个文件:a.txt,内容如下:
[test1]
comment = This is test
path = /test1/test
valid users = test
write list = test
admin users = test
browseable = yes
public = no
[test]
comment = This is test
path = /test1/test
valid users = test1
write list = test1
admin users = test1
browseable = yes
public = no
怎么样按照[test] 这个字符串打印出path = /test1/test 这一行,不能按行号来打印,因为可能有多段,求大神指导。
Python Code:
输出:'/test1/test'
追问没有输出,
Linux 系统还是加个 print 保险:
我这边是 Windows 系统,不加 print 可以直接输出:
谢谢!!