Forum Discussion

lalit_singh's avatar
lalit_singh
Contributor
2 years ago
Solved

Reading Setup Information .inf extension file

Hii All;

 

How can I read .inf file in test complete , I am using python as scripting language

  •  

    To read a .inf file in TestComplete using Python, you can use the open function to open the file in read mode, and then use the readlines method to read the contents of the file into a list of strings.

    Here is an example of how you could do this:

     

     
    # open the file in read mode
    with open('path/to/file.inf', 'r') as inf_file:
      # read the contents of the file into a list of lines
      lines = inf_file.readlines()
    
    # you can now access the lines of the file as elements of the list
    for line in lines:
      print(line)

    You can then process the lines of the file as needed in your test.

    Keep in mind that the .inf file format is a simple text-based format that is used to store information in a structured way. The specific structure and content of the .inf file you are reading may vary, so you will need to parse the file's contents appropriately to extract the information you need.

2 Replies

  • KB1's avatar
    KB1
    Champion Level 2

     

    To read a .inf file in TestComplete using Python, you can use the open function to open the file in read mode, and then use the readlines method to read the contents of the file into a list of strings.

    Here is an example of how you could do this:

     

     
    # open the file in read mode
    with open('path/to/file.inf', 'r') as inf_file:
      # read the contents of the file into a list of lines
      lines = inf_file.readlines()
    
    # you can now access the lines of the file as elements of the list
    for line in lines:
      print(line)

    You can then process the lines of the file as needed in your test.

    Keep in mind that the .inf file format is a simple text-based format that is used to store information in a structured way. The specific structure and content of the .inf file you are reading may vary, so you will need to parse the file's contents appropriately to extract the information you need.