python - pexpect parse a string -


i have expected string "version 0.0.9999.0"

i spawn correctly

e.expect('version 0.0.9999.0') 

and works fine, however, want make dynamic accept version (any 4 numbers separated dots). possible or have specific string? if yes, how?

thanks.

the method using expects pattern , not fixed string, per the documentation:

expect(self, pattern, timeout=-1, searchwindowsize=none)

this seeks through stream until pattern matched. pattern overloaded , may take several types. pattern can stringtype, eof, compiled re, or list of of types. strings compiled re types.

from say, regular expression "version \d.\d.\d{4}.\d", depends on possible values version. fixed strings there expect_exact.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -