0% found this document useful (0 votes)
13 views

Function Read

Uploaded by

Mohamed Mostafa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Function Read

Uploaded by

Mohamed Mostafa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

3/25/23, 4:59 PM Function: read

Function: read
Function Prototype

Note

Parameter Description

Return Value

Error Handling

Example

Result

This function enables you to read data from the opened file.

Function Prototype
File_object.read([size])

Note
When using the Read function, you need to open the existing file in a read mode through the
Open function.

If the length of the data needed to be read exceeds the maximum, you need to read all the
data of the file.

Parameter Description

Parameter Description

size Length of the data to be read. By default, the length of the data to be read is
the maximum data length of the file. The unit is byte, and the value must be
greater than 0.
This parameter is optional. If it is not set, all the data of the file is read by
default.

Return Value
The return value is the data read from the file.

https://10.98.117.5:31943/hedex/hedex.do?lib=OMC&id=omc.Scriptapp.mainpage&topicid=p_read_file_a&locale=en-us 1/2
3/25/23, 4:59 PM Function: read

Error Handling
None

Example
fp = Open("Hello.txt",'r') #Assume that the content of the Hello.txt file is 12345.
str = fp.read()
Print(str)

Result

12345

Copyright © Huawei Technologies Co., Ltd.

https://10.98.117.5:31943/hedex/hedex.do?lib=OMC&id=omc.Scriptapp.mainpage&topicid=p_read_file_a&locale=en-us 2/2

You might also like